When looking for a static variable declaration, we look backwards in the file from the variable to the start of the statement to see if it has the static keyword. Unfortunately, this can also find syntax like static function() { }, $foo... and incorrectly assume that means that the variable is static.
This PR updates the static declaration detection to explicitly ignore static closure definitions.
When looking for a static variable declaration, we look backwards in the file from the variable to the start of the statement to see if it has the
static
keyword. Unfortunately, this can also find syntax likestatic function() { }, $foo...
and incorrectly assume that means that the variable is static.This PR updates the static declaration detection to explicitly ignore static closure definitions.
Fixes https://github.com/sirbrillig/phpcs-variable-analysis/issues/280