Skip to content

Unable to use aliased String namespace since 8.2 #11152

Closed
@InvisibleSmiley

Description

@InvisibleSmiley

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions