|
1 | | -PHP_CodeSniffer VariableAnalysis |
2 | | -================================ |
| 1 | +# PHP_CodeSniffer VariableAnalysis |
3 | 2 |
|
4 | | -Plugin for PHP_CodeSniffer static analysis tool that adds analysis of problematic |
5 | | -variable use. |
| 3 | +Plugin for PHP_CodeSniffer static analysis tool that adds analysis of problematic variable use. |
6 | 4 |
|
7 | 5 | * Performs static analysis of variable use. |
8 | 6 | * Warns on use of undefined variables. |
9 | 7 | * Warns if variables are set or declared but never used within that scope. |
10 | 8 | * Warns if variables are redeclared within same scope. |
11 | 9 | * Warns if $this, self::$static_member, static::$static_member is used outside class scope. |
12 | 10 |
|
13 | | -INSTALLATION |
14 | | ------------- |
| 11 | +## Installation |
15 | 12 |
|
16 | | -Run ./install.sh -h to get install help. |
| 13 | +### Requirements |
17 | 14 |
|
18 | | -For a default install of PHP_Codesniffer via PEAR with PEAR in ~/pear you should be |
19 | | -safe to just run ./install.sh to use the default options, then copy the rules from |
20 | | -ruleset.xml into your own ruleset.xml. |
| 15 | +VariableAnalysis requires PHP 5.4 or higher and [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) version **3.0.2** or higher. |
21 | 16 |
|
22 | | -CUSTOMIZATION |
23 | | -------------- |
| 17 | +### Standalone |
| 18 | + |
| 19 | +1. Install PHP_CodeSniffer by following its [installation instructions](https://github.com/squizlabs/PHP_CodeSniffer#installation) (via Composer, Phar file, PEAR, or Git checkout). |
| 20 | + |
| 21 | + Do ensure that PHP_CodeSniffer's version matches our [requirements](#requirements) |
| 22 | + |
| 23 | +2. Clone the repository: |
| 24 | + |
| 25 | + git clone -b master https://github.com/sirbrillig/VariableAnalysis.git VariableAnalysis |
| 26 | + |
| 27 | +3. Add its path to the PHP_CodeSniffer configuration: |
| 28 | + |
| 29 | + phpcs --config-set installed_paths /path/to/VariableAnalysis |
| 30 | + |
| 31 | +If you already have installed paths, [use a comma to separate them](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-installed-standard-paths). |
| 32 | + |
| 33 | +## Customization |
24 | 34 |
|
25 | 35 | There's a variety of options to customize the behaviour of VariableAnalysis, take |
26 | 36 | a look at the included ruleset.xml for commented examples of a configuration. |
27 | 37 |
|
28 | | -KNOWN ISSUES & BUGS |
29 | | -------------------- |
| 38 | +## Original |
30 | 39 |
|
31 | | - * File scope isn't currently analysed. |
| 40 | +This was forked from the excellent work in https://github.com/illusori/PHP_Codesniffer-VariableAnalysis |
0 commit comments