NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #4864 most downloaded on Packagist
Code-Sniffer, Auto-Fixer and Tokenizer for PSR2-R
Latest stable
2.10.0
Last release 28 days ago
25 Oct 2026
Release timing varies
gaps range from 2 weeks to 4 months
Nearly every release is documented
notes for 44 of 46 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
47 releases · first in 2016
Drag across the ruler to compare, or tap a release to open it.
phpcbf no longer loops on inline parameter attributes (#48). SlevomatCodingStandard.Attributes.AttributeAndTargetSpacing moved the target of an attrib
phpcbf no longer loops on inline parameter attributes (#48). SlevomatCodingStandard.Attributes.AttributeAndTargetSpacing moved the target of an attribute such as #[SensitiveParameter] array $credentials onto its own line. That made the signature multi-line, so the trailing-comma sniffs added and removed a comma until phpcbf gave up with "FAILED TO FIX". Attributes on the same line as their target are now allowed.
Fixes from php-collective/code-sniffer 0.6.10, which is the new floor. Three of them reach sniffs PSR2R enables:
PhpCollective.Commenting.InlineDocBlock no longer rotates the words of an inline var annotation that has a description, and no longer adds a space before */ on every pass when the comment ends in . or similar.PhpCollective.WhiteSpace.ConsistentIndent keeps the PSR12 indent of a multi-line for (...) header.PhpCollective.Classes.Psr4 no longer aborts the whole run when there is no composer.json.Wrapped operators go to the start of the continuation line (#48). PhpCollective.Operators.OperatorPosition applies the rule Universal.Operators.ConcatPosition already enforces for . to &&, ||, and, or, xor, ??, the ternary ? and :, and binary arithmetic operators:
// before
$valid = $hasName &&
$hasEmail;
// after
$valid = $hasName
&& $hasEmail;
Multi-catch types are written without spaces (#48), the same as union types:
} catch (ValueError|TypeError $e) {
PhpCollective.WhiteSpace.CatchTypeSeparatorSpacing reports the spaced form, and PhpCollective.Operators.OperatorSpacing replaces PSR12.Operators.OperatorSpacing, which used to require the spaces. All other operators keep the PSR12 rule.
Both improvements report code that passed before. All new errors are auto-fixable with phpcbf. Adjust any baseline, phpcs:ignore or ruleset exclusion that names PSR12.Operators.OperatorSpacing: the same checks now report as PhpCollective.Operators.OperatorSpacing.
Full Changelog: https://github.com/php-fig-rectified/psr2r-sniffer/compare/2.9.0...2.10.0
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Security: raise the `squizlabs/php_codesniffer` floor to `^4.0.2`. CVE-2026-67434, an OS command injection advisory published 2026-08-05, covers >=4.0…
Security: raise the squizlabs/php_codesniffer floor to ^4.0.2. CVE-2026-67434, an OS command injection advisory published 2026-08-05, covers >=4.0.0,<4.0.2. The previous constraint allowed an affected version.
Generic.PHP.DeprecatedFunctions was effectively disabled (#45). The ruleset set the sniff's forbiddenFunctions property, which replaces the list the sniff builds in its constructor from the Reflection API rather than adding to it. The standard reported fewer deprecations than plain Generic did - utf8_encode() among them. Removed functions such as create_function() and each() moved to Generic.PHP.ForbiddenFunctions, where a property override is safe.
Both are fully covered by rules the standard already enables, so nothing stops being reported. Only the error codes change, which is why this is a minor rather than a patch - adjust any baseline or phpcs:ignore that names them.
PSR2R.PHP.DuplicateSemicolon (#47), superseded by SlevomatCodingStandard.PHP.UselessSemicolon, which reports everything it did and also catches a stray ; after a block.
PSR2R.WhiteSpace.UnaryOperatorSpacing, superseded by PhpCollective.WhiteSpace.ImplicitCastSpacing together with Generic.WhiteSpace.IncrementDecrementSpacing, both already enabled here. The reference operator was the last construct only the PSR2R sniff handled; php-collective/code-sniffer 0.6.7 covers it, and the floor moves to ^0.6.7 accordingly. The replacement also catches ! $b, which the PSR2R sniff missed.
Most PSR2R rules come from php-collective/code-sniffer. Its 0.6.5 to 0.6.7 releases land here with this bump and carry several fixes to sniffs PSR2R enables, including ConsistentIndent on PHP 8.4 property hooks, attribute names being rewritten as function calls, and DocBlockTagGrouping reporting a fix it never applied.
Full Changelog: https://github.com/php-fig-rectified/psr2r-sniffer/compare/2.8.1...2.9.0
Changed PSR2R.PHP.PreferStaticOverSelf to skip self:: usages inside final classes.
PSR2R.PHP.PreferStaticOverSelf to skip self:: usages inside final classes.Universal.CodeAnalysis.StaticInFinalClass, which correctly prefers self:: where late static binding cannot apply.Full Changelog: https://github.com/php-fig-rectified/psr2r-sniffer/compare/2.8.0...2.8.1
PSR2R.Commenting.DocBlock: skip fully-typed methods. Methods whose parameters and return type are all natively typed no longer require a docblock, red
PSR2R.Commenting.DocBlock: skip fully-typed methods. Methods whose parameters and return type are all natively typed no longer require a docblock, reducing noise on modern PHP 8.1+ codebases.PSR2R.WhiteSpace.DocBlockAlignment: avoid a PHPCBF max-loop conflict with PSR2R.WhiteSpace.TabIndent when fixing over-indented docblocks. The fixer now keeps structural docblock indentation tab-based instead of alternating between spaces and tabs. #43php-collective/code-sniffer to ^0.6.0, picking up its upstream fixes (including the DocBlockParamAllowDefaultValue positional-mismatch fix and additional type-safety improvements across sniffs).php-collective/code-sniffer 0.6:
AnonClassKeywordSpacing, FirstClassCallableSpacing, Operators.TypeSeparatorSpacing, Attributes.BracketSpacing, Attributes.DisallowAttributeParentheses, Attributes.TrailingComma, ControlStructures.DisallowAlternativeSyntax, CodeAnalysis.NoEchoSprintf, CodeAnalysis.ConstructorDestructorReturn, CodeAnalysis.ForeachUniqueAssignment, CodeAnalysis.StaticInFinalClassArrays.ArrayAccess, Attributes.AttributeAndTargetSpacing, Attributes.RequireAttributeAfterDocComment, Classes.BackedEnumTypeSpacing, Classes.EnumCaseSpacing, Classes.ClassMemberSpacing, Functions.NamedArgumentSpacing, ControlStructures.LanguageConstructWithParentheses, PHP.ForbiddenClassesPHP.DisallowSizeFunctionsInLoops, WhiteSpace.FunctionOpeningBraceSpaceFull Changelog: https://github.com/php-fig-rectified/psr2r-sniffer/compare/2.7.1...2.8.0
Allow @link and @see as inline doc comment markers
@link and @see as inline doc comment markersFull Changelog: https://github.com/php-fig-rectified/psr2r-sniffer/compare/2.7.0...2.7.1
Fix up new code-sniffer dependency v0.5 compatibility. Adds 1 sniff, removed 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
Fixed up TabAndSpaceSniff issues
Full Changelog: https://github.com/php-fig-rectified/psr2r-sniffer/compare/2.6.0...2.6.1
Added PSR2R.WhiteSpace.ArrayDeclarationSpacing sniff
Full Changelog: https://github.com/php-fig-rectified/psr2r-sniffer/compare/2.5.0...2.6.0
Added Squiz.ControlStructures.ForLoopDeclaration sniff
Full Changelog: https://github.com/php-fig-rectified/psr2r-sniffer/compare/2.4.3...2.5.0
### Fixes - Fixed up UnneededElse sniff
### Fixes - Added missing if/else sniffs.
### Fixes - Fixed bug in UnneededElse.
### Improvements - Update sniffs to PHPCS v4
Requires now https://github.com/php-collective/code-sniffer/releases/tag/0.3.0
This improvement ships with 14 new sniffs, many of them making array notation more consistent and reliable.
### Improvements - Removed deprecations
### Improvements - Removed deprecations
### Fixes - Fix broken unused uses sniff. - Fix ternary spacing sniff.
Skip FQCN to use statement refactor requirement for attributes
### Improvements - Added new PSR4 sniff Full Changelog: https://github.com/php-fig-rectified/psr2r-sniffer/compare/2.0.0...2.1.0
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.
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 ig
Reverted "silence removal of SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName" for now as there is no way to ignore Attributes for now.
Remove silencing of SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly
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.
Allow 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".
Fixed DocBlockReturnSelfSniff handling of self
selfRe-added fixed TabIndent sniff.
Re-added fixed TabIndent sniff.
Replace faulty sniff with working one.
Replace faulty sniff with working one.
Resolved problem of tab indentation breaking for certain sniffs
Removed invalid sniff, added some more useful ones.
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:
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-* 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
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.
Allowed phpstan-* and psalm-* tags to work.
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
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
This sniffer is now a combination of
creating a best practice bundle of ~180 sniffs.
Added NamespaceSpacingSniff to assert a newline before namespace statements as per PSR-12.
Added some more sniffs, PSR-12 and TrailingComma. Ruleset now ships with 127 sniffs.
Added some more sniffs, PSR-12 and TrailingComma. Ruleset now ships with 127 sniffs.
Use more PSR2 and low-level sniffs.
This ruleset now ships with 124 sniffs.
@return {type}).(x|y)[] mixed array type.Fixed newline assertion for beginning of class/trait body.
The PSR2R standard contains 109 sniffs now.
The PSR2R standard contains 108 sniffs now.
The PSR2R standard contains 108 sniffs now.
PHP 5.6+ is now the minimum.
Fix false/true bool annotation.
Fix false/true bool annotation.
### Improvements PHP 7.2/7.3 compatibility.
PHP 7.2/7.3 compatibility.
Uses new 3.0 phpcs sniffer tool.
Uses new 3.0 phpcs sniffer tool.
Also added/fixed:
### Bugfixes Fixed UnusedUse for PHP7
Fixed UnusedUse for PHP7
Also added new file name check for classes and interfaces.
Also added new file name check for classes and interfaces.
Added - InlineDocBlockSniff - DocBlockParamNotJustNullSniff
Added
Nothing published for this version
Nothing published for this version
We need still a few more tests and sniffers.
We need still a few more tests and sniffers.
One column per quarter.