must be a user-defined class name, internal class name given¶
Description¶
class_alias() creates an alias for a class, an enumeration, an interface or a trait. Until PHP 8.3, it was only possible to create such aliases with custom structures, and it was not possible to do it with PHP native classes.
Example¶
<?php
class_alias(stdClass::class, MyClass::Class);
?>
Solutions¶
Upgrade to PHP 8.3 or more recent.
Create a class that extends the PHP native class, and create an alias on this custom class.
Changed Behavior¶
This error may appear following an evolution in behavior, in previous versions. See classAliasWithInternalClass.
Changed Behavior¶
This error may appear following an evolution in behavior, in previous versions. See classAliasWithInternalClass.