sirbrillig / phpcs-variable-analysis

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

Feature Request: don't report on unused parameters for deprecated functions #302

Open jrfnl opened 1 year ago

jrfnl commented 1 year ago
/**
 * Function description.
 *
 * @deprecated #.#
 */
function foo($old_param, $another_old_param) {
    trigger_error('Deprecated function, use ... instead', E_USER_DEPRECATED);
    something_else($old_param);
}

The above code sample would trigger the following warning:

 8 | WARNING | Unused function parameter $another_old_param.
   |         | (VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable)

... while I would expect no warning as the function is deprecated.