-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Drupal Check incorrectly reporting "missing methods" on Interfaces, when methods actually exist on implementing class. #253
Comments
You need to type hint your code, then. |
Thank @mglaman ! |
@lhridley sorry for the quick reply earlier, so use Should I add documentation about this in this project, phpstan-drupal, or even Drupal.org? |
Hey @mglaman -- your comment is sufficient to point me in the right direction, but the error thrown is a bit cryptic. A more helpful and informative message would be extremely useful thought. If the message can't be made more informative somehow, then some documentation would be most helpful. |
The message can't really be improved. And we can't easily enhance it. So documentation on how to write more "aware" code vis type hinting is needed. |
I've started here: https://www.drupal.org/docs/develop/development-tools/phpstan I'll add a page about non-existent methods and type hinting later today |
How is drupal-check installed?
drupal-check is installed globally via Composer
Environment:
Describe the bug
Expected Behavior -- no detected errors
Actual Behavior -- errors flagged for "undefined method" on Interface.
The classes in question actually extends a Drupal Class that implements Drupal\Core\Entity\EntityInterface, but the declaration of the methods are not required on the Interface itself. So, it appears that the scanner is incorrectly flagging this as an "undefined method" on the Interface, even though the method is defined for the module's class in questions.
Console output
Link to public project Github Actions output:
The text was updated successfully, but these errors were encountered: