Closed sirbrillig closed 6 months ago
When trying to detect variables that are constructor promotion (see https://github.com/sirbrillig/phpcs-variable-analysis/pull/266 and https://github.com/sirbrillig/phpcs-variable-analysis/pull/294) we might also have variables that have nullable types. These variables were not being correctly identified as constructor promotion because the token we were examining to see if it was public/private/protected was actually not far enough back and we were instead looking at the ?.
public
private
protected
?
In this diff, we check for and ignore nullable tokens when looking for constructor promotion.
Fixes https://github.com/sirbrillig/phpcs-variable-analysis/issues/320
When trying to detect variables that are constructor promotion (see https://github.com/sirbrillig/phpcs-variable-analysis/pull/266 and https://github.com/sirbrillig/phpcs-variable-analysis/pull/294) we might also have variables that have nullable types. These variables were not being correctly identified as constructor promotion because the token we were examining to see if it was
public
/private
/protected
was actually not far enough back and we were instead looking at the?
.In this diff, we check for and ignore nullable tokens when looking for constructor promotion.
Fixes https://github.com/sirbrillig/phpcs-variable-analysis/issues/320