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

Bad resolving constant for duplicate class names #3424

Closed
integer opened this issue Jun 9, 2020 · 3 comments
Closed

Bad resolving constant for duplicate class names #3424

integer opened this issue Jun 9, 2020 · 3 comments

Comments

@integer
Copy link
Contributor

integer commented Jun 9, 2020

Bug report

I have legacy application with admin and customer section. Every section has own entry point with controllers loading and after it loads common "model classes" same for both sections. Some controllers has same name in admin and customer section.

Before 0.12.26 I have to split application into two blocks and check it separately - but this cannot profit from ResultCache.

In 0.12.26 (and .27) I can run code in one run. It's really impressive in this application! 👍 But there is a problem with constants in classes - static analysis loads constants from last class with same name and it generates false positives.

Code snippet that reproduces the problem

https://phpstan.org/r/7c762ecf-8549-475e-88e3-971be1557e55

Expected output

No errors will be great.

@ondrejmirtes
Copy link
Member

Thank you :) I was tuning this scenario on Adminer source code which declares multiple Min_DB classes :)

I'll modify self handling to use $scope->getClassReflection() instead of going through the ReflectionProvider which will fix this scenario.

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src@03a630e

More rules can take advantage of this which I'll do.

@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 May 17, 2021
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