Skip to content

Unable to use aliased String namespace since 8.2 #11152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
InvisibleSmiley opened this issue Apr 28, 2023 · 5 comments
Closed

Unable to use aliased String namespace since 8.2 #11152

InvisibleSmiley opened this issue Apr 28, 2023 · 5 comments

Comments

@InvisibleSmiley
Copy link

Description

The following code:

<?php
use Foo\Bar\String as MyString;

Resulted in this output:

Fatal error: Cannot alias 'Foo\Bar\String' as it is a built-in type in ... on line 3

But I expected this output instead:

Note that Foo\Bar\String is just a namespace (part), not a class/interface/trait/enum.

I checked the 8.2 documentation (migration guide, backward incompatible changes, changelog) and it seems to me this was not really intended. Worked fine up until 8.1.x.

PHP Version

8.2.0

Operating System

No response

@InvisibleSmiley
Copy link
Author

I was told the issue was caused by this:
#9402

@iluuu1994
Copy link
Member

Hi @InvisibleSmiley! What's the use case for this? This would've failed before as well, just in a different location.

https://3v4l.org/QM5mP

@InvisibleSmiley
Copy link
Author

As I said, my case is about namespaces only. Example (actual things / inheritance etc. in the NS are irrelevant):
https://3v4l.org/Q9Fbi

@iluuu1994
Copy link
Member

Hmm, I think this is an oversight of #9402.
@Girgias The use-case above looks valid as long as we support these keywords in namespaces, so I'm thinking we should revert the PR.

@Girgias
Copy link
Member

Girgias commented Apr 28, 2023

Fine with me, this only came up because someone on Room 11 was doing some weird stuff and not understanding the weird error message that resulted later.

Feel free to revert now or I'll do this next week when I get back from holiday. :)

iluuu1994 added a commit to iluuu1994/php-src that referenced this issue Apr 28, 2023

Verified

This commit was signed with the committer’s verified signature.
iluuu1994 Ilija Tovilo
This reverts commit b9f7123.

Fixes phpGH-11152
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants