Cannot use the static modifier on a parameter¶
Description¶
It is not possible to use static as a type for a parameter. It is possible for a return value, but not for parameters, not properties.
Example¶
<?php
class X {
function foo(static $argument) {
}
}
?>
Solutions¶
Use self pseudo-type.
Use the name of the class as type.
Use one of the interface as type.
Changed Behavior¶
This error may appear following an evolution in behavior, in previous versions. See ` <https://php-changed-behaviors.readthedocs.io/en/latest/behavior/.html>`_.