Skip to content
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

findOrFail stub doesn't have @throws #349

Closed
yyueniao opened this issue Oct 19, 2023 · 1 comment · Fixed by #351
Closed

findOrFail stub doesn't have @throws #349

yyueniao opened this issue Oct 19, 2023 · 1 comment · Fixed by #351
Assignees
Labels
bug Something isn't working

Comments

@yyueniao
Copy link

yyueniao commented Oct 19, 2023

Describe the bug
I note that findOrFail has a stub type:

/**

     * @template T

     * @param  T $id

     * @param  list<non-empty-string>  $columns

     * @psalm-return (T is (array|\Illuminate\Contracts\Support\Arrayable) ? \Illuminate\Database\Eloquent\Collection<int, TModel> : TModel)

     */

    public function findOrFail($id, $columns = ['*']) {}

But findOrFail should throw ModelNotFoundException. Since I am using checkForThrowsDocblock config so IMO I would like to enforce developers handle this exception.

Impacted Versions
Latest version

Additional context
Thanks for your effort of maintaining this amazing library.

@yyueniao yyueniao added the bug Something isn't working label Oct 19, 2023
alies-dev added a commit to alies-dev/psalm-plugin-laravel that referenced this issue Nov 4, 2023
@alies-dev
Copy link
Collaborator

alies-dev commented Nov 4, 2023

thanks you for reporting about this, @yyueniao!
fixed by 0c5545e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants