Replies: 1 comment
-
The expected behavior is that Psalm should analyze traits when they are used in a class (apart from scanning phase errors, e.g.
This is not right. Can you reproduce it in a separate repo and file an issue? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
https://psalm.dev/r/6af72d9647
In this case we have a clear error in declaring this method types - it accepts one type, returns a different one. However Psalm flags no issues. This seems to suggest Psalm isn't even trying as if it did this is a clear type mismatch
Interestingly, if you remove the name of the trait Psalm actually spots the type mismatch, as well as reporting a syntax error. This might be because of how Psalm processes input in the browser as I couldn't recreate this in a PHP file locally.
In the browser, adding a class that uses the trait seems to start spotting the issue: https://psalm.dev/r/92c78cf5e9
However this isn't the same in the codebase, I imagine due to the trait and class being declared in different files.
Beta Was this translation helpful? Give feedback.
All reactions