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

Slevomat Coding Standard for PHP_CodeSniffer provides many useful sniffs

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

Take phpcs.xml of ```xml foo ./vendor/* */thirdparty/* ``` And a file of ```php

Add a sniff to catch assignments within array structures. Example error: ```php $foo = [ $index = ['unexpected assignment here due to typo'], ]; ``` Similar purpose to the `SlevomatCodingStandard.ControlStructures.AssignmentInCondition`...

Enhancement

I often exclude `src/Entity` from this sniff due to Doctrine entities being non-final classes. However, adding `@final` annotation to these classes and including `checkTooWideReturnTypesInProtectedAndPublicMethods` in PHPStan config allows us to...

Enhancement

When we have two PHPDocs in a single line we are getting an error: ```console | ERROR | [x] Expected 1 line between annotations groups, found -1. (SlevomatCodingStandard.Commenting.DocCommentSpacing.IncorrectLinesCountBetweenAnnotationsGroups) ``` but...

PHPCS

Would it make sense for `SlevomatCodingStandard.TypeHints.UnionTypeHintFormat` to also format [Intersection Types](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/4fd52f75c8f29114423e9a379bf86fa894750bc3/src/Util/Tokens.php#L84), too?

When you use [type aliases by PHPStan](https://phpstan.org/writing-php-code/phpdoc-types#global-type-aliases), even if you use a `@phpstan-` prefixed annotation, like `@phpstan-param`, the `SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation` rule auto-corrects it to a FQCN and with that ruins it....

I use the following configuration: ```xml ``` So it means that after each `return` there must be an empty space. That’s good for the most part, but unfortunately I sometimes...

Consider the following small example php file: ```php ``` When running `phpcs --standard=SlevomatCodingStandard --sniffs=SlevomatCodingStandard.ControlStructures.DisallowYodaComparison` on this file, it results in an out-of-memory exception. Increasing the memory limit well beyond what...

Essentially what I wrote in the title. I added the `SlevomatCodingStandard.PHP.UselessParentheses` sniff to try to pick up on these useless parentheses from a recent code review: ```php $remoteAddress = (new...