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)
root@faaab3cb17ad:/var/www/xuanwutenant/vendor/bin# ./phpcs --standard=/var/www/xuanwutenant/phpcs.xml /var/www/xuanwutenant/app/Http/Controllers/FrontendApi/FrontendAuthController.php
PHP Fatal error: Uncaught ReflectionException: Function SjczTDG4TDK0Tweg() does not exist in /var/www/xuanwutenant/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php:37
Stack trace:
#0 /var/www/xuanwutenant/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php(37): ReflectionFunction->construct('SjczTDG4TDK0Twe...')
#1 /var/www/xuanwutenant/vendor/squizlabs/php_codesniffer/src/Ruleset.php(1196): PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\DeprecatedFunctionsSniff->construct()
#2 /var/www/xuanwutenant/vendor/squizlabs/php_codesniffer/src/Ruleset.php(217): PHP_CodeSniffer\Ruleset->populateTokenListeners()
#3 /var/www/xuanwutenant/vendor/squizlabs/php_codesniffer/src/Runner.php(332): PHP_CodeSniffer\Ruleset->__construct(Object(PHP_CodeSniffer\Config))
#4 /var/www/xuanwutenant/vendor/squizlabs/php_codesniffer/src/Runner.php(70): PHP_CodeSniffer\Runner->init()
#5 /var/www/xuanwutenant/vendor/squizlabs/php_codesniffer/bin/phpcs(18): PHP_CodeSn in /var/www/xuanwutenant/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php on line 37
SjczTDG4TDK0Tweg
would be marked as an internal function by PHP, so I'm not sure how to help. Anything special you are doing that might cause this?
exclude-pattern
(absolute
or relative
) is not supported: https://github.com/squizlabs/PHP_CodeSniffer/blob/a2bde796c6a6313e0a8ed730d33a0eb2cabeafa8/src/Ruleset.php#L1230-L1237
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.