You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since 1.2.0 we have problems with discovering symbols that were correct on 1.1.2 - it looks like it's related to MemoizingReflectionProvider::hasClass() and most probably PHPStan\Dependency\DependencyResolver::considerArrayForCallableTest().
<?phpdeclare(strict_types=1);
# Comment it and error disappears$array = ['y'];
classX
{
publicfunction__construct()
{
(new \Y())->get();
}
}
Somehow ['y'] is considered as callable and autoloading system tries to load class y. Result is cached within MemoizingReflectionProvider so when new \Y() is executed it won't work because PHPStan thinks class does not exist (provider uses lowercased names).
Additional info:
custom autoloader must(?) be used, we couldn't reproduce it with Composer's one
order of analysis is important, because if ['y'] is used after new \Y() it does not report error (in the example it's within one file, but in our repo it's in different files)
Expected output
No error like in 1.1.*
Did PHPStan help you today? Did it make you happy in any way?
I really like that @ondrejmirtes is available at Slack and I can ask him directly about our problems 🙂
The text was updated successfully, but these errors were encountered:
Bug report
Since 1.2.0 we have problems with discovering symbols that were correct on 1.1.2 - it looks like it's related to
MemoizingReflectionProvider::hasClass()
and most probablyPHPStan\Dependency\DependencyResolver::considerArrayForCallableTest()
.Code snippet that reproduces the problem
ℹ️ Reproducer repo
Somehow
['y']
is considered as callable and autoloading system tries to load classy
. Result is cached withinMemoizingReflectionProvider
so whennew \Y()
is executed it won't work because PHPStan thinks class does not exist (provider uses lowercased names).Additional info:
['y']
is used afternew \Y()
it does not report error (in the example it's within one file, but in our repo it's in different files)Expected output
No error like in 1.1.*
Did PHPStan help you today? Did it make you happy in any way?
I really like that @ondrejmirtes is available at Slack and I can ask him directly about our problems 🙂
The text was updated successfully, but these errors were encountered: