-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Description
Description
The following code allows the configuration of \array as a custom (anonymous) class.
<?php
$a = new class() {};
class_alias($a::class, \array::class);
function foo(\array $x) {
print_r($x);
}
foo($a);
?>Resulted in this output (see https://3v4l.org/Wsb8F)
class@anonymous Object
(
)
But I expected this output instead:
Cannot use 'array' as class name as it is reserved
Type declaration 'array' must be unqualified
As a side note, callable has the same behavior as 'array' and should be aligned.
PHP Version
8.3.13 (also 8.4 and older PHP versions)
Operating System
Tested on OSX, debian and ubuntu.
Reactions are currently unavailable