PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.
gsherwood on master
Fixed docblocks Because custom… (compare)
phpcs: Declaration of Glen84\Sniffs\Strings\DoubleQuoteUsageSniff::process(PHP_CodeSniffer\Files\File $phpcsFile, int $stackPtr) must be compatible with PHP_CodeSniffer\Sniffs\Sniff::process(PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) in D:\Programming\Standards\phpcs\Glen84\Sniffs\Strings\DoubleQuoteUsageSniff.php on line 15
$object = new \Abc();
- is there any sniff available that forces me to import that class instead of using the full class name?
Hello, I’m having this error:
487 | ERROR | [x] Line indented incorrectly; expected 5 tabs, found
| | 6
| | (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
for the following code:
if(blah)
foreach(blah){
}
I guess is caused by the lack of brackets in the first line. Is that a bug of ScopeIndent or is there a flag or sniff that should be used to fix the error?
<file>./src/</file>
<exclude-pattern>var/*</exclude-pattern>
<exclude-pattern >vendor/*</exclude-pattern>
<file>./src/</file>
<exclude-pattern type="relative">^./var/*</exclude-pattern>
<exclude-pattern type="relative">^./vendor/*</exclude-pattern>
develop
, I can help you get that working, but I'd need a little more information on how you've installed and are running PHPCS/PHPCompatibility (Phar, clones, Composer).
develop
) would be your best bet and yes, 10 already contains a huge amount of new checks related to PHP 8.
@glen-84 Sort of, though having a mixed installation like that makes it slightly more awkward. Basically PHPCompat adds a new dependency and you're currently missing that dependency.
There are several ways to solve it though:
composer install --no-dev
, then use the phpcs
command in the vendor/bin/
directory of PHPCompat to run the PHPCompat checks. This will only be useful if you run just and only PHPCompatibility over code.composer global phpcompatibility/php-compatibility:"dev-develop"
. You might need to make sure that your global Composer config file allows for 'minimum-stability': 'dev'
. You may also want to wait until PR PHPCompatibility/PHPCompatibility#1245 has been merged to prevent a possible exception being thrown (merge expected later today). PHPCompat + PHPCSUtils should automatically register themselves with the Composer globally installed PHPCS instance as the DealerDirect Composer PHPCS plugin will be installed as well.1.0.0-alpha3
tag and register the location of PHPCSUtils with the Composer global PHPCS instance via the installed_paths
config.Does that help ?
develop
, you will need to run composer global update phpcompatibility/php-compatibility --with-dependencies
regularly.
\r\n
line endings are reported as ERRORs with the following message: End of line character is invalid; expected "\n" but found "\r\n"\n
line ending character is considered as the only "correct" one.