Suppress UnusedFunctionParameter with underscore prefix
Author: glen-84Created Mar 23, 2018Updated May 7, 2026
LabelsType: enhancement
In cases where you need some of the parameters, but not all of them, for example:
// @codingStandardsIgnoreLine -- Not using the $slug parameter.
public function stageAction($id, $slug, $stageId)TypeScript allows you to use an underscore prefix to suppress the error/warning, like this:
public stageAction(id, _slug, stageId)Or, in PHP:
public function stageAction($id, $_slug, $stageId)It's a lot cleaner and less verbose in my opinion.
The variable name sniff would need an option to allow a single underscore in front of function parameters.
Source: squizlabs/PHP_CodeSniffer