Skip to content
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

require_once above use statement breaks namespace resolution #6348

Closed
W0rma opened this issue Jan 12, 2022 · 2 comments
Closed

require_once above use statement breaks namespace resolution #6348

W0rma opened this issue Jan 12, 2022 · 2 comments

Comments

@W0rma
Copy link

W0rma commented Jan 12, 2022

Bug report

The following code does not cause any errors (https://phpstan.org/r/a18abfec-c963-4f5b-afcf-416f557f34f3):

namespace abc;

use foo\bar;

require_once '';

/** @var bar $x */
$x = new bar();

However, adding require_once between namespace and use statement causes the error PHPDoc tag @var for variable $x contains unknown class abc\bar. (https://phpstan.org/r/5dd10c66-6a6b-48c4-9cc7-43808b0071af):

namespace abc;

require_once '';

use foo\bar;

/** @var bar $x */
$x = new bar();

Worked until v1.2
Broken in v1.3.3

The bug looks similar to #6252

Code snippet that reproduces the problem

https://phpstan.org/r/5dd10c66-6a6b-48c4-9cc7-43808b0071af

Did PHPStan help you today? Did it make you happy in any way?

Thank you for developing this great tool!

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src@b5a2c8f

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants