PHP_CodeSniffer icon indicating copy to clipboard operation
PHP_CodeSniffer copied to clipboard

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.

Results 231 PHP_CodeSniffer issues
Sort by recently updated
recently updated
newest added

**Describe the bug** I can run `phpcbf` for all my current rules and have them automatically fixed; however, there is no fixer for `Squiz.NamingConventions.ValidVariableName` rules to take my `$snake_case` variables...

When a sniff has a PHP error, phpcbf just says "No fixable errors were found", whereas phpcs shows the sniff file + line + error message.

Status: awaiting feedback
Status: duplicate

**Describe the bug** Using namespace alises (imports) the rule thinks a wrong type hint is used. **Code sample** ```php

Using squizlabs/php_codesniffer 3.7.1 in php project with PhpStorm 2021.1.4 I selected PSR12 in laravel 9/PHP 8.1 application : https://prnt.sc/zme0Neh817Cs I would like to add some more rules, like : 1)...

**Describe the bug** I use phpcs with VS Code and sometimes `phpcs` processes keep active in background for hours and even days, with actively consuming CPU. So I need to...

Since PHP 7.3, heredoc/nowdoc closers may be indented. This indent can use either tabs or spaces and the indent is included in the `T_END_HEREDOC`/`T_END_NOWDOC` token contents as received from the...

Bug

Since PHP 7.3, heredoc/nowdoc closers may be indented. This indent can use either tabs or spaces and the indent is included in the `T_END_HEREDOC`/`T_END_NOWDOC` token contents as received from the...

Bug

Use `space`/`spaces` depending on the value of the `$spacing` property instead of using `space(s)` in the error message. Original output: ![image](https://user-images.githubusercontent.com/663378/184382722-c6f403b1-73e1-49c6-ad3d-15c86cc94b81.png) Improved output: ![image](https://user-images.githubusercontent.com/663378/184382888-f1d77688-6249-49b0-a800-600416c58c86.png)

I'd like to preface this saying that I am very grateful for phpcs and that I understand that this PR represents an unpopular opinion. But while unpopular, it's consistent. I...

**Describe the bug** False Positive is thrown: WARNING Code after the EXIT statement on line [...] cannot be executed while it is a conditional exit statement. **Code sample** ```php $get_text...