psalm / psalm-plugin-laravel

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

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

Closed yyueniao closed 1 year ago

yyueniao commented 1 year 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 1 year ago

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