coding-standard
coding-standard copied to clipboard
Slevomat Coding Standard for PHP_CodeSniffer provides many useful sniffs
Seems that `SlevomatCodingStandard.Functions.RequireTrailingCommaInCall` doesn't report missing commas if the last param is an array function. For example, this doesn't report error: ```php $this->myFunction( $channel, 'request', fn ($m) => $m['param] );...
Hello, looks like this [sniff](https://github.com/slevomat/coding-standard/blob/master/doc/control-structures.md#slevomatcodingstandardcontrolstructuresdisallowtrailingmultilineternaryoperator-) does not report error for such cases: ```php function foo() {} $a = $b === 'a' ? foo() : 'c'; ``` ```php function foo() {}...
I saw the following sniffs around enums ```xml ``` But I think it would also be a good idea to have the recommended casing for enum cases to be added...
False positive SlevomatCodingStandard.Exceptions.RequireNonCapturingCatch.NonCapturingCatchRequired
Version: slevomat/coding-standard 8.14.1 Code to reproduce: ```php try { // Do something. } catch (\Exception $exception) { // Intentionally empty. } finally { \var_dump(isset($exception)); } ``` Error: Non-capturing catch is...
[I got a dependabot PR today](https://github.com/php-tuf/composer-stager/pull/286) that updates `slevomat/coding-standard` from 8.13.4 to 8.14.1, and I'm getting two new failures on the same code and configuration that was passing before. They...
There is the rule `SlevomatCodingStandard.Classes.RequireConstructorPropertyPromotion.RequiredConstructorPropertyPromotion` which enforces Constructor Property Promotion. Is there an other (additional) rule that marks private properties as readonly? For example: ```php private array $config; public function...
Is it possible to enforce multi-line attribute arguments? Example from https://github.com/squizlabs/PHP_CodeSniffer/issues/3656: Before: ``` #[OA\Post(path: '/users/register', description: 'Create an user account')] ``` After: ``` #[OA\Post( path: '/users/register', description: 'Create an user...
>composer show | grep -E "(parser|slevomat)" nikic/php-parser v4.17.1 A PHP parser written in PHP phpstan/phpdoc-parser 1.24.4 PHPDoc parser with support for nullable, intersection and generic types slevomat/coding-standard 8.14.1 Slevomat Coding...
`SlevomatCodingStandard.Namespaces.UnusedUses` thinks the imports are unused when property contains (nullable) intersection types. This code: ```php
I see code like ```php foreach ($usecases as $usecase) : $usecase->setDirty('name', true); $usecasesTable->save($usecase); endforeach; ``` in some of the projects. I would like to auto fix this via sniffer to...