Add Psalm to check for possibly fatal issues#973
Conversation
|
As part of this I got rid of Laravel-supported aliases, as Psalm doesn't understand |
djaiss
left a comment
There was a problem hiding this comment.
While I truly appreciate your contribution, I don't understand why Auth::user() is bad compared to Illuminate\Support\Facades\Auth::user(). If anything it makes things more complicated and getting rid of all the aliases seem a bit useless to me. Can you add more explanation?
|
Sure! So, basically,
If you’re really attached to them, I think they make the most sense in the views, which seem to use a PHPish syntax that Psalm doesn’t analyse (and where you can’t use |
There was a problem hiding this comment.
Did you try using https://packagist.org/packages/barryvdh/laravel-ide-helper instead of removing aliases ? If it's just to please to psalm when it's running, I don't see the benefit of removing laravel aliases.
|
We can consider here 2 cases : php code files, and blades files. |
5fabaa3 to
9a4237d
Compare
|
I've added back the aliases for views. Psalm finds five fatal issues introduced by #992: |
|
I've rebased and everything's good. There was a test timeout, but I think it's transitory? |
|
@muglug I tried psalm with barryvdh/laravel-ide-helper package, it's working well: The |
|
@asbiin sorry, must have missed that last comment. Trouble with |
|
@muglug I don't see the point. You can easily run |
|
@muglug OK it's working now (I've added CircleCI support). |
|
@asbiin I really don't care that much, but I also don't want to spend the time undoing my changes to get it to work with |
|
@muglug I tried it, but it doesn't work with |
|
I’d have to add, I think, a bunch of extra redirection to support |
|
@muglug Great. I would be glad to help adding some hacks to support aliases. |
|
You're welcome! |
|
@muglug indeed, thanks for your hard work and patience 😀 |
|
This pull request has been automatically locked since there |
As a followup to #878, this PR adds Psalm to the build process.
It uses the
dev-masterversion of Psalm, because I ran into a bug patched here. The fix downgradesUndefinedMethodissues toPossiblyUndefinedMethod) in this scenario. That code isn't actually problematic at all, but Psalm doesn't know thatview()always returns a\Illuminate\View\Viewwhen there are args passed to it.If you run Psalm with
vendor/bin/psalmyou'll see a lot of issues. To just see the errors, run