Skip to content

"Cannot declare xxx because the name is already in use" is broken with NS #13061

@mvorisek

Description

@mvorisek

Description

The following code:

<?php

namespace Ns;

use Ns\Foo;

class Foo {}

Resulted in this output:

(no output/error)

But I expected this output instead:

Fatal error: Cannot declare class Foo because the name is already in use

Without namespace, the error is emit as expected - https://3v4l.org/DAT52, but when namespace is declared, the error is not emit even if the the same use/import statement is present - https://3v4l.org/tt1sL.

As the declared Foo class masks the use/import the same way, I would expect an error to be emit in both cases.

PHP Version

any

Operating System

any

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions