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
{{ message }}
Repository navigation
PHPStan autoloader mechanics invoked for case which does not use autoloading at runtime #14976
runtime: run php real-world.php
you see the program runs, without the custom autoloader of e2e/bug-12972b/autoloader.php beeing invoked.
all involved classes are autoloaded by the composer class loader. the custom class loader is not invoked for \other12972\MyClass::class.
static analysis time: run ../../bin/phpstan analyze
you see PHPStan invokes the custom class loader for class \other12972\MyClass::class, which does not happen at regular runtime. the composer class loader is not invoked for \other12972\MyClass::class (like it is at runtime).
because of the difference in autoloading functions order in runtime vs. analysis time we see errors which cannot happen at runtime
Code snippet that reproduces the problem
No response
Expected output
phpstan should not analyze the code as if the autoloader was invoked (as we saw it isn't at runtime)
Did PHPStan help you today? Did it make you happy in any way?
Activity
mergeable commentedon Jul 20, 2026
This bug report is missing a link to reproduction at phpstan.org/try.
It will most likely be closed after manual review.
ondrejmirtes commentedon Aug 27, 2026
Opening this again because the solution broke too many common use cases and the patches didn't make the situation better.
Fix reverted in phpstan/phpstan-src#6292.
Cover the loader shapes the reverted autoloader attempts broke
Cover the loader shapes the reverted autoloader attempts broke
Do not let a bootstrap autoloader's exception abort the analysis
Do not let a bootstrap autoloader's exception abort the analysis
Do not let a bootstrap autoloader's exception abort the analysis
Do not let a bootstrap autoloader's exception abort the analysis
Do not let a bootstrap autoloader's exception abort the analysis
Do not let a bootstrap autoloader's exception abort the analysis
Do not let a bootstrap autoloader's exception abort the analysis
Do not let a bootstrap autoloader's exception abort the analysis