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
Internal Error: Call to a member function loadClass()
on int
#7150
Comments
This bug report is missing a link to reproduction at phpstan.org/try. It will most likely be closed after manual review. |
I'm a little bit baffled by this error. Could you please replicate that in a small repository? Thanks. |
I'm not sure if it's possible. We have custom directory structure, custom app architecture, custom autoloader, custom bootstrap, custom PHPStan runtime config... I don't know if I can extract what's required to reproduce it (like in rectorphp/rector#7135). I'll work on it today and try to investigate further. |
Looking at the stack trace, this seems to happen inside a |
@stof but it works properly without bleeding edge enabled, with the same architecture, file structure, analysis range and configs. Hence this issue, because it's strictly related to changing PHPStan config. |
I guess the custom autoloader is somehow causing this mess 😊 Try to use scanDirectories to find the classes instead. https://phpstan.org/user-guide/discovering-symbols |
@ondrejmirtes CC: @TomasVotruba |
I'd like to see what your custom autoloaders do to understand this problem. |
@Wirone Reproducible repository would be indeed the most helpful :) |
@ondrejmirtes @TomasVotruba I'll try create something (after May 3rd, got holidays 🌴 ), but it won't be easy and I can't promise anything 😅 |
@Wirone An idea - does your problem happen when you disable OPCache? |
@ondrejmirtes @TomasVotruba I have exactly the same problem, and it's also related to a Rector rule.
Turning off the PS. I don't have any custom autoloaders. |
@luxemate Can you please reproduce that in a small repository? No one with this problem actually got around to it yet so I can’t look into it. |
FYI: it was already discussed on Slack. I've tested with PS. Thank you @luxemate for the reproducer 👍 |
Reproduced: 047f3d8 |
Please test PHPStan 1.6.5 with this fix https://github.com/phpstan/phpstan/releases/tag/1.6.5 |
@ondrejmirtes I've tested - it works. Thank you and have a great day! |
It looks like 1.6.5 fixed the issue for us too 🎉 I was able to remove temporary workaround with explicit autoload rule. Thank tou @ondrejmirtes 🍻 |
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. |
Bug report
After upgrading to 1.6.3 and enabling bleeding edge rules, we got this error when analysing one of our areas.
Code snippet that reproduces the problem
I don't know what exactly is causing the issue, but probably something related to bootstrap and autoloading. The
-v
stacktrace:app/utils/rector/src/AppRectorSets.php
:In
composer.json
we have:FYI: I've masked actual namespace and filenames, but it's as close as it can be to the original.
Expected output
No internal error
Did PHPStan help you today? Did it make you happy in any way?
Bleeding edge rules allowed me to find some dead code in one class 🎉
The text was updated successfully, but these errors were encountered: