Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Jan 31 2019 22:52
    jrfnl commented #2387
  • Jan 31 2019 22:41
    valeryan commented #2386
  • Jan 31 2019 22:40
    valeryan commented #2386
  • Jan 31 2019 22:40
    valeryan commented #2386
  • Jan 31 2019 22:17
    gsherwood commented #2387
  • Jan 31 2019 22:14
    gsherwood milestoned #2387
  • Jan 31 2019 22:13
    gsherwood labeled #2386
  • Jan 31 2019 22:13
    gsherwood commented #2386
  • Jan 31 2019 22:05
    gsherwood milestoned #2388
  • Jan 31 2019 22:03
    gsherwood labeled #2394
  • Jan 31 2019 22:02
    gsherwood commented #2394
  • Jan 31 2019 22:02
    gsherwood closed #2394
  • Jan 31 2019 22:02

    gsherwood on master

    Fixed docblocks Because custom… (compare)

  • Jan 31 2019 22:02
    gsherwood milestoned #2394
  • Jan 31 2019 16:50
  • Jan 31 2019 16:00
    SteepDevs starred squizlabs/PHP_CodeSniffer
  • Jan 31 2019 15:22
  • Jan 31 2019 14:39
    sebastiaanluca commented #2304
  • Jan 31 2019 14:38
    sebastiaanluca commented #2304
  • Jan 31 2019 13:09
    rlauenroth starred squizlabs/PHP_CodeSniffer
Kevin Nowaczyk
I should say that adding a require() for this particular file in my phpunit bootstrap file did work. However, I feel the auto-loader should have been able to do it on its own...no?
Will Otterburn
Is there a sniff that detects when use statements aren't in alphabetical order?
Brian Smith
in sublime text 3 with php cs and the Drupal standard, I cannot get the unused use statement to ever work, anyone know if there is some config option that must be specified?
Amir hossein Hossein Zadeh Karimi
Hi, I'm try to add a rule to php-cbf for add a space character after end of php tags which the line will end with no other character.
Is there someone to help me?

Hi, is it possible to extend phpcs rules(ruleset.xml) with phpcsfixer rules like yoda_style?

$finder = PhpCsFixer\Finder::create()

$config = [
'@PSR2' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'yoda_style' => true,

return PhpCsFixer\Config::create()

Hello everyone which rule to be use for qualifier to use as import
I am trying to avoid this kind of warning occurs. please tell me which rule to cover it.
Greg Sherwood
@harrisdt15f That's not a built-in PHPCS rule. I don't know which coding standard you are using, but you'll probably need to ask whoever maintains it.
hello everyone I got this error need help please

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->

#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

Greg Sherwood
@harrisdt15f That sniff gets a list of all defined functions, then uses the reflection API to see if the functions marked "internal" are deprecated. I don't know why a function called 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?

Hello guys, on the Drupal forum, we are wondering if we should keep the Fully Qualified Class Name in phpDoc comment blocks.

So, in case of Unqualified Class Name used with use statement, do you know if PHP_CodeSniffer would complain about the "unused use statement" rule?

Hi @Kwadz , no it won't complain. It doesn't check for that at all.
Hello, Is it possible to have phpcs flag class properties with no type? Is it also possible to phpcbf add in a property type based off what is set inside of the constructor?
Greg Sherwood
@TaylorSasser You can use the PSR2.Classes.PropertyDeclaration sniff to enforce that member vars have visibility declared (or just use the PSR2 standard) but PHPCBF will not add visibility automatically for you. If visibility is not provided the member var is obviously public so it could be auto-fixed, but I prefer for PHPCBF to only make formatting fixes (or move code around) and not add new code for you. Missing visibility doesn't necessarily mean the developer wants the member var to be public - they may have just forgotten to set it - so it feels like a code review thing.
Hi, is there a chat room for web developers.
Hello, It looks like the type of path exclude-pattern (absolute or relative) is not supported: https://github.com/squizlabs/PHP_CodeSniffer/blob/a2bde796c6a6313e0a8ed730d33a0eb2cabeafa8/src/Ruleset.php#L1230-L1237
Will PHPCS 4 drop support for PHP < 7.2, so that we can use parameter type hints, etc. (in custom rules)? PHP 5.6 has been EOL for a long time now.
@glen-84 What's holding you back from doing that for your own standard already ?
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
Why is the activity section to the right of Gitter not up-to-date?
@glen-84 Sorry about that, I was getting confused with return type declarations which can be added without an issue: https://3v4l.org/I0NaA
No problem. :slight_smile:
Nico Haase
Hi there! I'm searching for a specific sniff, but cannot find it - probably, because I'm unsure about the proper search terms.... Within some classes, I use code from other classes and instantiate it using $object = new \Abc(); - is there any sniff available that forces me to import that class instead of using the full class name?
hello everyone which rule is able to use to check for commenting in constant.
Nico Haase
@harrisdt15f what do you mean by that? I don't see any comment in that constant
@NicoHaase Thank you for your reply, I want to analyze like this kind of constant without having any comment, I means which rule can check to avoid writhing such kind of constant without having comments
Anton Samoylenko
Hello. I got Codesniffer checking based on PSR12, but I need to include Generic.PHP.RequireStrictTypes also. Can I include this sniff via phpcs option or I need to create new ruleset that will include this sniff?
Greg Sherwood
@Fantom409 You need to create a new ruleset for this
Shaunak Sontakke
Does PHP_CodeSniffer integrate with Phabricator? I want to see PHP_CodeSniffer violations while I do code reviews on Phabricator.
Ricardo Puerto

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:


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?

sorry the chat deleted the spaces in the second and third line, but there is 1 tab
of course if I add brackets to the if the error disappears
Marco Polichetti
Hi dudes. I'm trying to better refine my phpcs.xml coding standard, but I have a problem, can't relative exclude some directories
<exclude-pattern >vendor/*</exclude-pattern>
The above is working...
But this is not working:
<exclude-pattern type="relative">^./var/*</exclude-pattern>
<exclude-pattern type="relative">^./vendor/*</exclude-pattern>
Anyone knows why?
Chetan Prajapati🇮🇳
I am getthing this error on VSCode phpcs: The "WordPress" coding standard is not installed. Please review your configuration an try again.
Chetan Prajapati🇮🇳
This has been fixed! :)
Dmitry Zelonkin
Hello guys! Is it possible to detect unused php imports?
i don't suppose anyone is active to help me?
anybody active?