PHP_CodeSniffer
PHP_CodeSniffer copied to clipboard
PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
**Describe the bug** phpcbf will format multiline ternaries to the same level of indentation, instead of having the lines after the first indented an additional level. **Code sample** ```php ```...
Caches used in GH Actions do not get updated, they can only be replaced by a different cache with a different cache key. Now the predefined Composer install action this...
**Describe the bug** `Generic.Functions.FunctionCallArgumentSpacing.NoSpaceAfterComma` should not report in case comma is followed by right parenthesis because it collides with `PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket` and fails to fix the file **Code sample** ```php foo('bar',);...
**Describe the bug** `PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket` forbids space before close bracket, but it should not be reported if last value in call is heredoc/nowdoc **Code sample** This is okay ```php function test()...
Given this code: ```php ``` Running the `Squiz.PHP.EmbeddedPhp` sniff over it results in: ``` ------------------------------------------------------------------------------------------------------------- FOUND 3 ERRORS AFFECTING 1 LINE ------------------------------------------------------------------------------------------------------------- 1 | ERROR | [x] Expected 1 space...
**Describe the bug** I run phpcbf command, it fixed a lot of files, but it left this message "A TOTAL OF 43 ERRORS WERE FIXED IN 2 FILES" PHPCBF FAILED...
Inspired by https://github.com/symfony/symfony/blob/6.2/src/Symfony/Component/Console/Command/Command.php#L37-L40, to make the code more readable and to avoid miss-using exit codes.
## Describe the bug I get false positive `Generic.WhiteSpace.ScopeIndent.IncorrectExact` when an foreach has an heredoc in it. ### Code sample ```
## Describe the bug PHPSniffer managed to run forever analyzing a certain CSS file. (I discovered later, 'practically forever', as in longer than the heat death of the universe, but...
**Code sample** ```php