[php-src] Issue #13061: "Cannot declare xxx because the name is already in use" is broken with NS
| From: | mvorisek | Date: | Mon, 01 Jan 2024 11:52:11 +0000 |
| Subject: | [php-src] Issue #13061: "Cannot declare xxx because the name is already in use" is broken with NS | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246163@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/13061
Author: mvorisek
### Description
The following code:
```php
<?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