sirbrillig / phpcs-variable-analysis

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

Add explicit types for 'nested_parenthesis' #286

Closed sirbrillig closed 1 year ago

sirbrillig commented 1 year ago

This adds PHPDoc types when accessing the keys of the 'nested_parenthesis' property of tokens. From what I know, the type of that property is always array<int, int>, but for some reason in the most recent update of Psalm it no longer is able to figure that out, so here we add explicit types for it.

I'm not sure if the keys can ever be some other type, but just in case this type allows them to be either string or null also.