fig-r/psr2r-sniffer
PHP_CodeSniffer ruleset implementing PSR-2-R for PHP 8.1+ projects. Includes 190+ sniffs, supports CI, and can auto-fix many issues via phpcbf. Install with Composer and reference the bundled PSR2R ruleset in phpcs.xml.
[@link](https://github.com/link) and [@see](https://github.com/see) as inline doc comment markersFull Changelog: https://github.com/php-fig-rectified/psr2r-sniffer/compare/2.7.0...2.7.1
Notable change: Attributes are now handled like classes, so no FQCN inside, but normal use statements.
Full Changelog: https://github.com/php-fig-rectified/psr2r-sniffer/compare/2.6.1...2.7.0
Full Changelog: https://github.com/php-fig-rectified/psr2r-sniffer/compare/2.6.0...2.6.1
Full Changelog: https://github.com/php-fig-rectified/psr2r-sniffer/compare/2.5.0...2.6.0
Full Changelog: https://github.com/php-fig-rectified/psr2r-sniffer/compare/2.4.3...2.5.0
This improvement ships with 14 new sniffs, many of them making array notation more consistent and reliable.
Full Changelog: https://github.com/php-fig-rectified/psr2r-sniffer/compare/2.0.0...2.1.0
Includes quite a few improvements including type safety. Currently, PSR2R ships with over 190 sniffs.
Reverted "silence removal of SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName" for now as there is no way to ignore Attributes for now.
SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnlyAllow for new slevomat/coding-standard 8.x. This is to allow for all new fixes of that series to be used by everyone.
Please note You need to add the php_version config in your root phpcs.xml file before upgrading.
E.g. if you are using >= 7.4 in composer as PHP min requirement:
<config name="php_version" value="70400"/>
The reason is that it would otherwise execute your local PHP version (e.g. 8.1) and modify the code according to "too new language features".
selfRe-added fixed TabIndent sniff.
Replace faulty sniff with working one.
Removed invalid sniff, added some more useful ones.
The old string[] syntax is deprecated and replaced by generics, as it can now also focus on key instead of just value:
array<string> (list) vs array<string, string> (assoc array)\MyCollection|\MyObject[] as legacy typehint in place. Custom [@phpstan-](https://github.com/phpstan-)* tags on top can be "clean" already.With PHP 7.3 being already EOL soon, it only makes sense to drop the already very long EOL 7.2 version. It is already PHP 8.1 tested, however, as well.
Quite a few more sniffs to make sure the code is also semantically checked even before any static analyzer like PHPStan/Psalm look at it.
Upgrade to new slevomat/coding-standard v7
Previous releases were a bit wonky (1.1.0 was released on a wrong branch it seems), please use this one moving forward.
Note: This version recommends changing code as per PHP 7.2+.
If your code needs to run also on lower versions, please use the previous version and the corresponding ^0.6 constraint here.
This sniffer is now a combination of
creating a best practice bundle of ~180 sniffs.
This sniffer is now a combination of
creating a best practice bundle of ~180 sniffs.
How can I help you explore Laravel packages today?