Tag reference
@unused-param
The @unused-param tag marks a single argument as intentionally left
unread inside the function body — for example, a parameter that exists only
to satisfy an interface or callback signature the implementation does not
actually need. Static analyzers commonly warn about unused parameters as a
sign of a mistake, but that warning is a false positive whenever the
parameter is unused on purpose; rather than disabling the check for the
whole function, this tag suppresses it for exactly the one parameter named.
Grammar
"@phan-unused-param" <Variable> [ <Description> ]"@unused-param" <Variable> [ <Description> ]Examples
/** * @unused-param $ctx */public function handle(Request $request, array $ctx): Response/** * @unused-param $previous This listener never needs the old value. */function onChange(mixed $current, mixed $previous): voidNames by platform
- phan
@phan-unused-param- standard
@unused-param
Parsing an @unused-param tag produces a VariableTag instance exposing
$variable: the parameter’s name, without the leading $.
final class UnusedParamTag extends VariableTag{ // Adds nothing of its own; $variable is // declared on the parent VariableTag. public readonly string $variable;}