-
Notifications
You must be signed in to change notification settings - Fork 25
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
Issue with ::class and Missing Return Statement in CI #335
Comments
Interesting. No one reported this so far, and I don't have a clue right now why I would fail. Is this a Magento project or a Magento module? In the latter case, the only difference would be the way the generated files get created. Locally it's Magento logic, in CI it would be our module. What happens if you replace the And which PHPStan version are you using? |
I can currently reproduce this issue in two different custom modules: one using a data patch and another using a ViewModel. For example, in the phtml file: Using the alternative: Versions:
|
I've tested this today intensively, and I cannot reproduce the wrong behavior locally. Since you say it works locally but breaks in CI, how do you invoke PHPStan locally and how do you invoke PHPStan in CI? Any other differences? Maybe different PHP versions? |
Just wondering, is this fixed with the dev-master version & PHPStan 2.0? |
It throws an error locally as well when I remove one of the ignored files. I'm not sure if this is due to PHPStan 2.0 or if it's a clue to the original issue.
registration.php
Maybe you'll be able to identify the error more quickly. |
Oh, wait - I see it now! It's probably because of the "Extension" in the module name, right? 😆 |
Yeah the extension attribute autoloader is kicking in. Would probably be good to have some blacklist you can configure to ignore those errors. Currently, your only option is to rename the class ;( |
The module name should not be the issue, the class name is probably the issue. You check check both autoloaders what name postfixes we are matching. |
Sorry about that - I was checking the wrong project and file. I should have looked at the original post. With PHPStan 2.0, the behavior is the same: no error locally, but in CI, it throws the same issue as in the original post. I could set up a project on gitlab.com that reproduces the error so you can debug it. What do you think? |
Hello,
I’m encountering an issue where referencing a class with
::class
causes the referenced class to throw the following error in CI (but not locally):As an example, this happens when working with data patches that have dependencies:
In this setup, the error is thrown in CI, even though everything runs fine locally.
Has anyone experienced this behavior? Could it be related to a specific configuration?
Any guidance on resolving this discrepancy would be greatly appreciated.
The text was updated successfully, but these errors were encountered: