Variables that are created and not used anywhere in the code are most likely useless. Such variables consumes memory, use code space and may create confusion.
As a simple check, any variable only used once in a context should be checked.
Variables that are arguments are subject of a distinct rule, as their existence is under another set of constraints. See Unused arguments
This rule is aimed at eliminating unused variables or arguments.
The following patterns are considered warnings:
<?php
$x = 10;
?>
The following patterns are not considered warnings:
<?php
$x = 10;
$x++;
?>
If you don't want to be notified about unused variables, you can turn this rule off.