Replies: 1 comment
-
This apparently isn't possible yet: phpstan/phpstan#11707. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In commit 2f83567, more advanced types were added to
Builder::with
. More specifically:These new types pose an issue for my existing codebase, with larastan on high levels. An example:
Currently, this is incompatible with
Builder::with
, because the function definition is invariant. ChangingHasMany
toRelation
also breaks, becausewhereBelongsTo
is not available onRelation
. While I agree this is technically correct, laravel also tightly couples the relation name and it's type. If I follow the current types I would have to check the type of relation each time:This not only is very tedious, but laravel will already throw if I supply the wrong relation type. The situation could also be easily solved by making the
Relation
type covariant:Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions