Menu
Error Identifier: argument.unused
Every error reported by PHPStan has an error identifier. Here’s a list of all error identifiers. In PHPStan Pro you can see the error identifier next to each error and filter errors by their identifiers.
Code example #
<?php declare(strict_types = 1);
define('MY_CONST', 'value', true);
Why is it reported? #
The third argument $case_insensitive of define() is ignored since PHP 8.0. Declaration of case-insensitive constants was deprecated in PHP 7.3 and the parameter was removed in PHP 8.0. Passing this argument has no effect and is silently ignored.
How to fix it #
Remove the third argument:
<?php declare(strict_types = 1);
-define('MY_CONST', 'value', true);
+define('MY_CONST', 'value');
How to ignore this error #
You can use the identifier argument.unused to ignore this error using a comment:
// @phpstan-ignore argument.unused
codeThatProducesTheError();
You can also use only the identifier key to ignore all errors of the same type in your configuration file in the ignoreErrors parameter:
parameters:
ignoreErrors:
-
identifier: argument.unused
Rules that report this error #
- PHPStan\Rules\Functions\DefineParametersRule [1]