PHP_CodeSniffer
PHP_CodeSniffer copied to clipboard
PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
Added some missing documentation ## Description This is just some house-keeping to keep the docs up to date. I had to spend some time reviewing the php code to figure...
A sniff similar to `Squiz.Classes.SelfMemberReference.NotUsed` for the new statement would be useful. `Squiz.Classes.SelfMemberReference` is only looking for `T_DOUBLE_COLON` and that does not include "new ClassName"
## Context At places like https://github.com/squizlabs/PHP_CodeSniffer/blob/7566b4d89de1d08d2a8ad85910507d6633a35d28/src/Reports/Code.php#L169 we report the full file location. `basepath` is a config property that can be used to remove it, but doesn't fully work for this....
## Describe the bug `phpcs:enable` can sometimes wind up overriding a later `phpcs:ignore` for the rule. This can particularly happen when multiple `phpcs:enable` comments are present in the file. ###...
## Describe the bug If a closure/anonymous function is used as a callback in a function call, then indentations doesn't get fixed with `Generic.WhiteSpace.ScopeIndent` sniff property `exact` set to `true`....
**Code sample** ```php
## Describe the bug `Generic.Formatting.MultipleStatementAlignment` doesn't work correctly with `match()`. ### Code sample ```php ./packages ``` ### To reproduce Steps to reproduce the behavior: 1. Create a file called `test.php`...
**Describe the bug** Generic.WhiteSpace.ScopeIndent reports multiline `yield from` statements as being incorrectly indented even if the indentation is correct. I've only tested this with tab indentation. **Code sample** ```php ```...
## Describe the bug The ScopeIndent sniff suggests a quite strange indentation when processing multi-nested `match`-statements ### Code sample ```php
Inject the configuration object in the constructor instead of creating the instance without having the ability to change it. Currently it's not possible to change the configuration because it's using...