psalm / psalm-plugin-laravel

A Psalm plugin for Laravel
MIT License
307 stars 72 forks source link

Added Eloquent Model alias at ApplicationProvider #273

Open eusonlito opened 1 year ago

eusonlito commented 1 year ago

Related with issue https://github.com/psalm/psalm-plugin-laravel/issues/271

eusonlito commented 1 year ago

@lptn The failed tests are my bad?

alies-dev commented 1 year ago

@eusonlito

The failed tests are my bad?

I don't think so. Codeception tests failed due to Psalm changes (a new output), Laravel projects tests failed due to a flag to find unused code. I'll try to fix both tomorrow (if there are no other volunteers), but it will be nice to add tests for your changes.

eusonlito commented 1 year ago

@lptn

but it will be nice to add tests for your changes.

I don't know how codeception works 😥

mr-feek commented 1 year ago

Thanks for the PR! 🤝

This seems reasonable to me.

However, I did just think of a slight edge case. Consider that Eloquent isn't aliased in the application at runtime in actual code, however the runtime code actually references Eloqouent as if it was an alias -- psalm would think that Eloquent is aliased and the code will work properly, rather than resulting in an error reported by psalm.

I really think this should be fixed upstream in ide-helper, but I think I'm okay with merging this as-is for now.

alies-dev commented 8 months ago

Hey @eusonlito Do you still have this issue with \Eloquent? Do we need to work on this PR?

Is this PR related to the issue https://github.com/barryvdh/laravel-ide-helper/pull/1352 ?