You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you initialize a Builder through the ::query() method on a class-string, the generic on the Builder isn't correctly deduced from the generic of the class-string, and defaults to Model. This can be easily tested by trying to access a local scope on the query, as demonstrated by the code below. This results in a PHPStan error: Call to an undefined method Illuminate\Database\Eloquent\Builder::test()..
It's debatable whether this is a bug or rather a feature request.
Description
When you initialize a
Builder
through the::query()
method on aclass-string
, the generic on theBuilder
isn't correctly deduced from the generic of theclass-string
, and defaults toModel
. This can be easily tested by trying to access a local scope on the query, as demonstrated by the code below. This results in a PHPStan error:Call to an undefined method Illuminate\Database\Eloquent\Builder::test().
.It's debatable whether this is a bug or rather a feature request.
Laravel code where the issue was found
The text was updated successfully, but these errors were encountered: