A PHP_CodeSniffer standard for Variable Analysis

dev-master 2016-06-27 14:29 UTC

This package is not auto-updated.

Last update: 2020-05-29 18:56:41 UTC


Plugin for PHP_CodeSniffer static analysis tool that adds analysis of problematic variable use.

  • Performs static analysis of variable use.
  • Warns on use of undefined variables.
  • Warns if variables are set or declared but never used within that scope.
  • Warns if variables are redeclared within same scope.
  • Warns if $this, self::$static_member, static::$static_member is used outside class scope.


Run ./ -h to get install help.

For a default install of PHP_Codesniffer via PEAR with PEAR in ~/pear you should be safe to just run ./ to use the default options, then copy the rules from ruleset.xml into your own ruleset.xml.


There's a variety of options to customize the behaviour of VariableAnalysis, take a look at the included ruleset.xml for commented examples of a configuration.


  • File scope isn't currently analysed.