mixed
is forbidden PHP-T1006The mixed
type already includes null
, so specifying mixed
type as a nullable is redundant and doesn't make any sense. PHP lets you typehint properties, parameters, and return values as mixed
which can contain any value.
To fix this issue, it is recommended to drop null
from the nullable mixed
type.
class ErrorHandler
{
// invalid: mixed already includes null
private ?mixed $lastFatalTrace = null;
}
class ErrorHandler
{
private mixed $lastFatalTrace = null;
}