Commit 4f8e440
Bug fix: false negative unused var (#120)
* Bug fix: false negative unused var
As reported in 111, if a variable is assigned a value with a combined assignment operator, it would not be reported as unused.
Includes unit tests.
Fixes 111
* PHPStan config: don't report unmatched errors
Now the `PHP_CodeSniffer\Util\Tokens` file is imported, the `Constant T_\w+ not found` errors should no longer be thrown.
However, it depends on the order in which the files are analysed as that file is not (yet) `use`d in all files using the `T_` constants.
If I remove the `ignoreErrors`, [the build fails](https://circleci.com/gh/sirbrillig/phpcs-variable-analysis/281) on those errors for the `VariableAnalysisSniff` file, while if I leave the exclusion in, [the build fails](https://circleci.com/gh/sirbrillig/phpcs-variable-analysis/283) on a "Ignored error not matched".
So, for now, I'm leaving the ignore pattern in place and turning `reportUnmatchedIgnoredErrors` off to allow the build to pass.1 parent 58002d1 commit 4f8e440
File tree
4 files changed
+38
-1
lines changed- VariableAnalysis
- Lib
- Tests/CodeAnalysis
- fixtures
4 files changed
+38
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
256 | 257 | | |
257 | 258 | | |
258 | 259 | | |
259 | | - | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
260 | 265 | | |
261 | 266 | | |
262 | 267 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
923 | 923 | | |
924 | 924 | | |
925 | 925 | | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
926 | 939 | | |
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
0 commit comments