psalm / psalm-plugin-laravel

A Psalm plugin for Laravel
MIT License
298 stars 69 forks source link

`findOrFail` stub doesn't have `@throws` #349

Closed yyueniao closed 9 months ago

yyueniao commented 10 months ago

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.

alies-dev commented 9 months ago

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