fig-r/psr2r-sniffer
Code-Sniffer, Auto-Fixer and Tokenizer for PSR2-R
2.9.0
1.4M downloads/mo
#4620 most downloaded on Packagist
php-fig-rectified/psr2r-sniffer
What this package is like to depend on
Last release 17 days ago
06 Aug 2026
Release timing varies
gaps range from 2 weeks to 4 months
Rarely documented
notes for 10 of 45 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
46 releases · first in 2016
12 releases in the last 12 months
see the full history below
Release timeline
46 releases · Feb 2016 to Aug 2026Releases
latest 46-
2.9.006 Aug 2026Release notes
Open source →Fixes
-
Security: raise the
squizlabs/php_codesnifferfloor 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.DeprecatedFunctionswas effectively disabled (#45). The ruleset set the sniff'sforbiddenFunctionsproperty, 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 plainGenericdid -utf8_encode()among them. Removed functions such ascreate_function()andeach()moved toGeneric.PHP.ForbiddenFunctions, where a property override is safe.
Improvements
- Duplicate reporting removed (#47). Four constructs were each flagged by two rules at once: inline assignment, method modifier order, double semicolons and Yoda conditions. In every case the rule with the wider coverage stays and the narrower one is silenced, so the same code is still caught - once instead of twice.
Removed sniffs
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:ignorethat names them.-
PSR2R.PHP.DuplicateSemicolon(#47), superseded bySlevomatCodingStandard.PHP.UselessSemicolon, which reports everything it did and also catches a stray;after a block. -
PSR2R.WhiteSpace.UnaryOperatorSpacing, superseded byPhpCollective.WhiteSpace.ImplicitCastSpacingtogether withGeneric.WhiteSpace.IncrementDecrementSpacing, both already enabled here. The reference operator was the last construct only the PSR2R sniff handled;php-collective/code-sniffer0.6.7 covers it, and the floor moves to^0.6.7accordingly. The replacement also catches! $b, which the PSR2R sniff missed.
Note
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, includingConsistentIndenton PHP 8.4 property hooks, attribute names being rewritten as function calls, andDocBlockTagGroupingreporting a fix it never applied.Full Changelog: 2.8.1...2.9.0
-
-
2.8.128 Jun 2026Release notes
Open source →Fixes
- Changed
PSR2R.PHP.PreferStaticOverSelfto skipself::usages inside final classes. - This avoids a fixer conflict with
Universal.CodeAnalysis.StaticInFinalClass, which correctly prefersself::where late static binding cannot apply.
Full Changelog: 2.8.0...2.8.1
- Changed
-
2.8.008 Jun 2026Release notes
Open source →Fixes
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 withPSR2R.WhiteSpace.TabIndentwhen fixing over-indented docblocks. The fixer now keeps structural docblock indentation tab-based instead of alternating between spaces and tabs. #43
Improvements
- Bumped
php-collective/code-snifferto^0.6.0, picking up its upstream fixes (including theDocBlockParamAllowDefaultValuepositional-mismatch fix and additional type-safety improvements across sniffs). - Enabled 22 additional sniffs to stay aligned with
php-collective/code-sniffer0.6:- Universal —
AnonClassKeywordSpacing,FirstClassCallableSpacing,Operators.TypeSeparatorSpacing,Attributes.BracketSpacing,Attributes.DisallowAttributeParentheses,Attributes.TrailingComma,ControlStructures.DisallowAlternativeSyntax,CodeAnalysis.NoEchoSprintf,CodeAnalysis.ConstructorDestructorReturn,CodeAnalysis.ForeachUniqueAssignment,CodeAnalysis.StaticInFinalClass - SlevomatCodingStandard —
Arrays.ArrayAccess,Attributes.AttributeAndTargetSpacing,Attributes.RequireAttributeAfterDocComment,Classes.BackedEnumTypeSpacing,Classes.EnumCaseSpacing,Classes.ClassMemberSpacing,Functions.NamedArgumentSpacing,ControlStructures.LanguageConstructWithParentheses,PHP.ForbiddenClasses - Squiz —
PHP.DisallowSizeFunctionsInLoops,WhiteSpace.FunctionOpeningBraceSpace
- Universal —
Full Changelog: 2.7.1...2.8.0
-
2.7.124 Jan 2026Release notes
Open source →Fixes
- Allow
@linkand@seeas inline doc comment markers - Relax docblocks when fully typed (as per parent lib)
- Improve DocBlockReturnSelfSniff and DocBlockParamNotJustNullSniff (as per parent lib)
Full Changelog: 2.7.0...2.7.1
- Allow
-
2.7.027 Nov 2025Release notes
Open source →Improvements
- 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: 2.6.1...2.7.0
-
2.6.112 Nov 2025 -
2.6.025 Oct 2025Release notes
Open source →Improvements
- Cleaned up signatures.
- Added PSR2R.WhiteSpace.ArrayDeclarationSpacing sniff
- Added Squiz.WhiteSpace.ScopeClosingBrace sniff
Full Changelog: 2.5.0...2.6.0
-
2.5.022 Oct 2025Release notes
Open source →Improvements
- Added Squiz.ControlStructures.ForLoopDeclaration sniff
- Improved PSR2R.ControlStructures.ControlStructureSpacing sniff
Full Changelog: 2.4.3...2.5.0
-
2.4.322 Oct 2025 -
2.4.220 Oct 2025 -
2.4.120 Oct 2025Nothing published for this version
-
2.4.029 Sep 2025Nothing published for this version
-
2.3.023 Aug 2025Nothing published for this version
-
2.2.112 May 2025Nothing published for this version
-
2.2.029 Mar 2025Nothing published for this version
-
2.1.223 Dec 2024Nothing published for this version
-
2.1.115 Nov 2024Nothing published for this version
-
2.1.029 Mar 2024Nothing published for this version
-
2.0.015 Oct 2023Nothing published for this version
-
1.5.123 Sep 2023Nothing published for this version
-
1.5.001 Jan 2023Nothing published for this version
-
1.4.015 Aug 2022Nothing published for this version
-
1.3.518 Jun 2022Nothing published for this version
-
1.3.423 Nov 2021Nothing published for this version
-
1.3.319 Nov 2021Nothing published for this version
-
1.3.215 Nov 2021Nothing published for this version
-
1.3.108 Nov 2021Nothing published for this version
-
1.3.001 Nov 2021Nothing published for this version
-
1.2.019 Oct 2021Nothing published for this version
-
1.0.113 Nov 2020Nothing published for this version
-
1.0.026 Jun 2020Nothing published for this version
-
1.0.0-beta19 Apr 2020 pre-releaseNothing published for this version
-
0.6.428 Nov 2019Nothing published for this version
-
0.6.321 Nov 2019Nothing published for this version
-
0.6.228 Sep 2019Nothing published for this version
-
0.6.105 Sep 2019Nothing published for this version
-
0.6.003 Sep 2019Nothing published for this version
-
0.5.230 Jul 2019Nothing published for this version
-
0.5.116 May 2019Nothing published for this version
-
0.5.030 Aug 2017Nothing published for this version
-
0.4.109 Mar 2017Nothing published for this version
-
0.3.111 Jul 2016Nothing published for this version
-
0.427 Feb 2017Nothing published for this version
-
0.313 Apr 2016Nothing published for this version
-
0.210 Mar 2016Nothing published for this version
-
0.115 Feb 2016Nothing published for this version