You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The above code currently generated an Unused function parameter and an Unused variable $var warning, however, as there is a require in the function, the parameter and the variable may well be (and are) used in the included file.
I'd suggest lowering the severity in that case to 4. That means that in a normal PHPCS run it will not show up, though can be made to show with --severity=4.
Alternatively a separate error code or a configurable property could possibly be used to prevent/silence these type of false positives.
Note: the below code sample should still throw an error/warning.
functionname() {
require_once__DIR__ . '/views/my-view.php';
$var = 'something'; // Unused and as declared *after* the include, it cannot be used in the included file.
}
The text was updated successfully, but these errors were encountered:
This is a good idea, and thank you for the suggestions. A configurable property would be the easiest as it wouldn't be a breaking change. Perhaps we could start with that and see how it works, then we could try the other options in a future version.
The above code currently generated an
Unused function parameter
and anUnused variable $var
warning, however, as there is arequire
in the function, the parameter and the variable may well be (and are) used in the included file.I'd suggest lowering the severity in that case to
4
. That means that in a normal PHPCS run it will not show up, though can be made to show with--severity=4
.Alternatively a separate error code or a configurable property could possibly be used to prevent/silence these type of false positives.
Note: the below code sample should still throw an error/warning.
The text was updated successfully, but these errors were encountered: