-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed
Description
Description
This issue is most notable with the array
keyword as it is also a built-in type name.
Indeed trying to alias int
:
<?php
use int as I;
Parses just fine (however it is impossible to actually use I as a type declaration as you would get the following error Fatal error: Cannot use 'int' as class name as it is reserved in /in/nNOgL on line 5
(see https://3v4l.org/nNOgL) which is its own mess that we might want to catch early)
However, with array
(https://3v4l.org/fWrTK):
<?php
use array as a;
We get the following error message:
Parse error: syntax error, unexpected token "array" in /in/F6SlE on line 3
I don't even know if this is actually fixable as this seems like some parser shenanigans.
PHP Version
PHP 8.0.22 - master
Operating System
No response