sirbrillig / phpcs-variable-analysis

Find undefined and unused variables with the PHP Codesniffer static analysis tool.
Other
135 stars 14 forks source link

Use custom logic for finding arrow function scope #296

Closed sirbrillig closed 1 year ago

sirbrillig commented 1 year ago

It appears that at least in some versions of phpcs, the arrow function scope detection is not correct. It incorrectly considers a closing square bracket (]) inside the body of an arrow function to close that arrow function's scope.

We already have custom logic for finding arrow function scopes so that it will work for versions of PHP/phpcs which do not support arrow functions. In this PR we remove the simpler path and rely only on the custom logic.

Fixes https://github.com/sirbrillig/phpcs-variable-analysis/issues/295