coding-standard icon indicating copy to clipboard operation
coding-standard copied to clipboard

Slevomat Coding Standard for PHP_CodeSniffer provides many useful sniffs

Results 133 coding-standard issues
Sort by recently updated
recently updated
newest added

The following class generates `SlevomatCodingStandard.Classes.PropertyDeclaration.NoSpaceBeforeNullabilitySymbol` for `array`. ```php abstract class Test { abstract public function begin(): static; protected array $field = []; } ``` The issue does not appear when...

Currently there's no sniff to ensure that constants are typed through native types. I'd like to introduce a sniff that enables this and ensures the following: ```php class A {...

👋 Hi there! The diff looks a little wild, but I essentially only swapped the sections for the `UseFromSameNamespace` and the `UseDoesNotStartWithBackslash` sniffs, which were not in the correct alphabetically...

**vendor/bin/phpcbf --standard=phpcs.dist.xml** ``` FFFFFFFFFFFFFFPHP Fatal error: Uncaught PHP_CodeSniffer\Exceptions\RuntimeException: Undefined array key "scope_closer" in /var/www/vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/UseStatementHelper.php on line 238 in /var/www/vendor/squizlabs/php_codesniffer/src/Runner.php:623 Stack trace: #0 /var/www/vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/UseStatementHelper.php(238): PHP_CodeSniffer\Runner->handleErrors(2, 'Undefined array...', '/var/www/vendor...', 238) #1 /var/www/vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/SniffLocalCache.php(42):...

See: https://github.com/php/php-src/pull/14546 Therefore is should be added to `FunctionHelper::SPECIAL_FUNCTIONS`

DisallowMixedTypeHintSniff does not report error when attribute #[Override] is presented.

[PHP_CodeSniffer 4.0.0beta1](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/tag/4.0.0beta1) has been released. Currently, the `composer.json` of slevomat/coding-standard does not allow 4.0.0: https://github.com/slevomat/coding-standard/blob/1501a612f9457c3d58c2850fd97e854f9c6d46b3/composer.json#L19 Is it possible to update the version constraint to allow `"^4.0"`? Thank you for your...

For the record: I am getting ` PHP Fatal error: Uncaught AssertionError: assert($firstOnLinePointer !== null) in /app/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Classes/AbstractPropertyConstantAndEnumCaseSpacing.php:67 ` on a CRLF formatted file ``` s$ cat -A ProductCustomFields.php | head...