NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist · #574 most downloaded on Packagist
A PHPCS sniff to detect problems with variables.
Last release 2 months ago
27 Jul 2026
Ships fairly regularly
a new release about every 3 months
Nearly every release is documented
notes for 55 of 57 stable releases
Nothing withdrawn
no release was ever pulled
9 years old
74 releases · first in 2017
This is a large refactor which greatly increases the speed and accuracy of phpcs-variable-analysis by adding a dependency on phpcsutils.
This is a large refactor which greatly increases the speed and accuracy of phpcs-variable-analysis by adding a dependency on phpcsutils.
Dependencies
Refactoring (using phpcsutils)
getUseIndexForUseImport using findContainingOpeningBracket() (948d77f)findFunctionCallArguments custom loop with PassedParameters::getParameters() (3a0b6e4)isConstructorPromotion manual scan with FunctionDeclarations::getParameters() (5b97e89)areAnyConditionsAClass manual loop with Conditions::hasCondition() (f4ac147)getListAssignments using Lists::getAssignments (75768da)findContainingOpeningBracket with phpcsutils equivalent (6b1bdda)isVariableInsideUnset/isVariableInsideIssetOrEmpty with phpcsutils equivalents (6a30e89)T_FN (9da451f)isArrowFunction block in getScopeCloseForScopeOpen (4cc7f35)Full Changelog: v2.13.0...v3.0.0
One column per quarter.
Restore version and dependabot updates from 2.x branch
Full Changelog: v3.0.0-beta.9...v3.0.0-beta.10
This is preparing for a major 3.0 release which adds a dependency on PHPCSUtils. The new version should have the same functionality, fix some subtle b
This is preparing for a major 3.0 release which adds a dependency on PHPCSUtils. The new version should have the same functionality, fix some subtle bugs, and increase performance by over 2x.
Dependencies
Refactoring (using phpcsutils)
getUseIndexForUseImport using findContainingOpeningBracket() (948d77f)findFunctionCallArguments custom loop with PassedParameters::getParameters() (3a0b6e4)isConstructorPromotion manual scan with FunctionDeclarations::getParameters() (5b97e89)areAnyConditionsAClass manual loop with Conditions::hasCondition() (f4ac147)getListAssignments using Lists::getAssignments (75768da)findContainingOpeningBracket with phpcsutils equivalent (6b1bdda)isVariableInsideUnset/isVariableInsideIssetOrEmpty with phpcsutils equivalents (6a30e89)T_FN (9da451f)isArrowFunction block in getScopeCloseForScopeOpen (4cc7f35)Full Changelog: v2.13.0...v3.0.0-beta.9
This is preparing for a major 3.0 release which adds a dependency on PHPCSUtils. The new version should have the same functionality, fix some subtle bugs, and increase performance by over 2x.
getUseIndexForUseImport using findContainingOpeningBracket().findFunctionCallArguments custom loop with PassedParameters::getParameters().isConstructorPromotion manual scan with FunctionDeclarations::getParameters().areAnyConditionsAClass manual loop with Conditions::hasCondition().getListAssignments using Lists::getAssignments.findContainingOpeningBracket with the PHPCSUtils equivalent.isVariableInsideUnset/isVariableInsideIssetOrEmpty with PHPCSUtils equivalents.T_FN.isArrowFunction block in getScopeCloseForScopeOpen.Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Ruleset: update schema URL by @jrfnl in #353
Full Changelog: v2.12.0...v2.13.0
GH Actions: use the xmllint-validate action runner by @jrfnl in #350
Full Changelog: v2.11.22...v2.12.0
sitePassByRefFunctions (#351).Improve phpstan configuration by @szepeviktor in #344
Full Changelog: v2.11.21...v2.11.22
Only search for nested arrow functions if necessary by @sirbrillig in #342
Full Changelog: v2.11.20...v2.11.21
Support nested arrow functions by @sirbrillig in #334
Full Changelog: v2.11.19...v2.11.20
compact inside arrow functions (#339).GH Actions: work around intermittent apt-get errors by @jrfnl in #322
Switch to PHPCSStandards/PHP_CodeSniffer by @jrfnl in #315
Full Changelog: v2.11.17...v2.11.18
Nothing published for this version
Nothing published for this version
Do not close scope of ref reassignment when inside else (#306).
else (#306).Allow newlines in arrow functions (#301).
Fix scope closer detection in arrow function detection (#298).
Use custom logic for finding arrow function scope (#296).
Support readonly constructor promotion (#294).
readonly constructor promotion (#294).Allow non-enum tokens called 'enum' (#293).
Add support for enum methods (#289).
Composer: allow for the 1.0.0 version of the Composer PHPCS plugin (#287).
Prevent detecting static closures when looking for static variables (#281).
Fix function call detection to exclude non-function tokens (#279).
Place static arrow function body outside of scope on static declaration check (#276). Fixes a static variable regression from #267.
static variable regression from #267.Bug fix release for two regressions caused by the new static function variable scanning added in #267.
Bug fix release for two regressions caused by the new static function variable scanning added in #267.
Allow for loop increment expression to use a variable defined inside the loop (#262).
for loop increment expression to use a variable defined inside the loop (#262).if list destructure (#268).php_errormsg from superglobals list (#269).Fix a deprecation notice in PHP 8.2 (#248), plus internal housekeeping.
Update for Composer 2.2 (#242).
Respect ignoring undefined variables in else blocks (#239).
else blocks (#239).Allow parsing mixed HTML and PHP (#234, #236).
Start inline block scope at end of condition rather than at keyword (#230).
allowUnusedVariablesInFileScope option (#229).Nothing published for this version
Treat writing to a by-reference foreach loop variable as a read (#221).
foreach loop variable as a read (#221).Nothing published for this version
Performance: only check one parent for recursive list assignment (#218). In at least one example file this brought the speed from 7 minutes down to 0.
Note: this release intentionally excludes breaking changes from the 3.0 branch, namely replacing UnusedVariable with UnusedParameter for parameters (#…
A large release that backports nearly all the improvements made on the 3.0 branch to the 2.x line, with the major exception of adding PHPCSUtils as a dependency.
Notable changes since 2.9:
array_walk pass-by-reference in 2.x (#216).isset and empty (#204).if/else (#199).allowUndefinedVariablesInFileScope option (#193).allowUnusedVariablesBeforeRequire option (#196).validUndefinedVariableRegexp option (#173).else blocks (#189).Note: this release intentionally excludes breaking changes from the 3.0 branch, namely replacing UnusedVariable with UnusedParameter for parameters (#195) and adding sniff codes for the array assignment shortcut (#205).
Nothing published for this version
Nothing published for this version
Backports some 3.x features to the 2.x line.
Backports some 3.x features to the 2.x line.
allowUnusedVariablesBeforeRequire option (originally #196).allowUndefinedVariablesInFileScope option (originally #193).Downgrade requirements from PHP 5.6 to 5.4 (#191, backported to 2.x).
A backport of the bugfixes from 3.0.0-beta.1 into the 2.x version without any of the PHPCSUtils changes.
A backport of the bugfixes from 3.0.0-beta.1 into the 2.x version without any of the PHPCSUtils changes.
foreach loops with option (#167).Nothing published for this version
A small bug fix release with test and package clean-up.
A small bug fix release with test and package clean-up.
$this in nested function declaration (#119).self/static within an anonymous class (#110).require (#106), update DealerDirect Composer plugin requirement (#112).composer.lock file (#117).Add apcu_* functions to getPassByReferenceFunctions (#103).
apcu_* functions to getPassByReferenceFunctions (#103).Consider get_defined_vars() to be a read (#92).
get_defined_vars() to be a read (#92).Recognize that variable variables are not assignments (#88).
Downgrade CircleCI image to PHP 5.6 (#86). Fixes a PHP 5.6 regression introduced in 2.6.2 and corrects the Composer minimum PHP version.
Allow global var assignment to count as a read (#83).
Improve check for static var defs inside functions (#80).
self and static references in a trait (#76).Enable allowUnusedForeachVariables and allowUnusedCaughtExceptions (#73).
allowUnusedForeachVariables and allowUnusedCaughtExceptions (#73).Add ignore unused foreach option (#66).
foreach option (#66).self within class method closures (#70).allowWordPressPassByRefFunctions option (#69).Handle variable class static refs (#63).
allowUnusedParametersBeforeUsed default to true (#59).Add allowUnusedParametersBeforeUsed option (#58).
allowUnusedParametersBeforeUsed option (#58).Your coding agent can read these notes before it upgrades. Set up the MCP server →