Bug #80224 [Opn]: namespaced import alias inconsistent
| From: | nikic@php.net | Date: | Mon, 12 Oct 2020 11:19:49 +0000 |
| Subject: | Bug #80224 [Opn]: namespaced import alias inconsistent | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-229564@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80224&edit=1
ID: 80224
Updated by: nikic@php.net
Reported by: xigal18570 at jarilusua dot com
Summary: namespaced import alias inconsistent
Status: Open
Type: Bug
Package: *General Issues
Operating System: linux
PHP Version: 8.0.0rc1
Block user comment: N
Private report: N
New Comment:
> use\Foo\Bar3; // valid
While this is valid, it's actually a namespace reference, not a use declaration.
I think the correct action here is to forbid the use of a leading \ in use declarations, which
should never have been allowed. This will need a deprecation first though, so it's not
actionable for PHP 8.0.
Previous Comments:
------------------------------------------------------------------------
[2020-10-12 11:14:41] xigal18570 at jarilusua dot com
Description:
------------
Maybe the description is missing here:
https://wiki.php.net/rfc/namespaced_names_as_token
Test script:
---------------
<?php
use \Foo\Bar2; // valid
use\Foo\Bar3; // valid
use \Foo\Bar4 as Bar44; // valid
use\Foo\Bar5 as Bar55; // invalid
Expected result:
----------------
last variant being valid as well
Actual result:
--------------
$ sudo docker-compose run --rm --user "$(id --user):$(id --group)" php php test.php
Parse error: syntax error, unexpected token "as" in /app/test.php on line 6
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80224&edit=1