|
// Are we a function or closure parameter? |
|
// It would be nice to get the list of function parameters from watching for |
|
// T_FUNCTION, but AbstractVariableSniff and AbstractScopeSniff define everything |
|
// we need to do that as private or final, so we have to do it this hackish way. |
I have no clue how old that comment is, but it definitely isn't valid anymore and hasn't been valid for a long time.
The File::getMethodParameters() utility method can retrieve information on all declared parameters for functions, closures (since PHPCS 2.8.0), arrow functions (since PHPCS 3.5.4) and closure use statements (since PHPCS 3.5.0).
Ref: https://pear.php.net/package/PHP_CodeSniffer/docs/3.5.4/apidoc/PHP_CodeSniffer/File.html#methodgetMethodParameters
To change this would probably require a refactor, but it would also make the code more stable and simpler.
phpcs-variable-analysis/VariableAnalysis/Sniffs/CodeAnalysis/VariableAnalysisSniff.php
Lines 464 to 467 in 2976bca
I have no clue how old that comment is, but it definitely isn't valid anymore and hasn't been valid for a long time.
The
File::getMethodParameters()utility method can retrieve information on all declared parameters for functions, closures (since PHPCS 2.8.0), arrow functions (since PHPCS 3.5.4) and closure use statements (since PHPCS 3.5.0).Ref: https://pear.php.net/package/PHP_CodeSniffer/docs/3.5.4/apidoc/PHP_CodeSniffer/File.html#methodgetMethodParameters
To change this would probably require a refactor, but it would also make the code more stable and simpler.