-
-
Notifications
You must be signed in to change notification settings - Fork 946
Description
Bug report
We are running PHPStan in a legacy project and the rather new rules *.internal and *.internalClass blow up quite a lot of cases.
Legacy Class-name based pseudo-namespaces
One rather severe case is that in legacy projects one might have classes that are still not namespaces via namespace Foo but via the class-name Foo_. This is not taken into consideration and causes a lot of issues.
Symfony polyfills
Another one - where I am not sure whether it is a n issue with Symfonys polyfills or with PHPStan - is that Polyfill-classes are interpreted like they are instantiated directly.
So something like
use \Collator;
$f = Collator::NUMERIC_COLLATION;will result in this error to be raised:
Access to constant NUMERIC_COLLATION of internal class Symfony\Polyfill\Intl\Icu\Collator from outside its root namespace Symfony.
Which is plain wrong as we are not really calling it (and the Intl extension is installed, so the polyfill shouldn't be called at all). We explicitly want to use the \Collator class.
Code snippet that reproduces the problem
The legacy class-name based pseudo-namespaces can be reproduced via
https://phpstan.org/r/37ab2b43-bfa3-449e-9684-7e4e663e9d71
The symfony polyfills require a small project to reproduce the issue as it requires a polyfill to be available.
Expected output
The expected output of such a case would be no errors at all
Did PHPStan help you today? Did it make you happy in any way?
No response