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

ReflectionProvider: "Method of class MyClass cannot be used as the class is not loaded in file" #7333

Closed
RomulusED69 opened this issue May 27, 2022 · 8 comments

Comments

@RomulusED69
Copy link

Bug report

I use an extension with the ReflectionProvider.
Since PHPStan 1.6, I had an error when activating bleedingEdge. Without, there is no problem. With PHPStan 1.7, with or without bleedingEdge, I have the error
Method of class MyClass cannot be used as the class is not loaded in file
WindowsTerminal_NdNkittgQl

Code snippet that reproduces the problem

I created repository with same error. The extension used is very similar to mine.

Expected output

No problem with class not found.

I don't know if the problem comes from the way the extension is written or from PHPStan.

Thx for your help

@mergeable
Copy link

mergeable bot commented May 27, 2022

This bug report is missing a link to reproduction at phpstan.org/try.

It will most likely be closed after manual review.

@ondrejmirtes
Copy link
Member

I cloned your repository, installed dependencies and ran PHPStan without an error:

$ vendor/bin/phpstan
Note: Using configuration file /Users/ondrej/Downloads/phpstan-reflection-class-bug/phpstan.neon.
 4/4 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%



 [OK] No errors

@RomulusED69
Copy link
Author

um... That's problematic.
I'll try to see if I can get PHPStan to work without errors.
Can you tell me your configuration?

I'll keep the issue open and if I find out what the problem is, I'll put the answer here.

@ondrejmirtes
Copy link
Member

What configuration? I cloned the repo and ran PHPStan with your configuration :) I'm on PHP 8.1 but I also tried it with 8.0.

@RomulusED69
Copy link
Author

I don't know. I'm trying to figure out why it works for you and not for me.
I rm cache, change PHP version, still the error...
Maybe an extension is the problem.

@ondrejmirtes
Copy link
Member

I have some reason to believe PHPStan 1.7.7 is going to fix that thanks to: ondrejmirtes/BetterReflection@2a0638b

Please test it once I release it later today, and report back :) Thank you.

@RomulusED69
Copy link
Author

Yes, I confirm, it's OK.

Thx you very much.

@github-actions
Copy link

github-actions bot commented Jul 2, 2022

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 Jul 2, 2022
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