-
Notifications
You must be signed in to change notification settings - Fork 71
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
Support hasMany(...)->orderBy() #190
Comments
Seems to be a known issue: psalm-plugin-laravel/tests/acceptance/EloquentRelationTypes.feature Lines 335 to 348 in 723221a
|
According to a local
If this is true, the error was introduced upstream in 4.0.0-beta3...4.0.0. |
It looks like the Previously, the psalm-plugin-laravel/src/Handlers/Eloquent/RelationsMethodHandler.php Lines 60 to 61 in 723221a
Accordingly, the psalm-plugin-laravel/src/Handlers/Eloquent/RelationsMethodHandler.php Lines 88 to 98 in 723221a
|
Here's the current (failing) output: array:3 [
"stmt" => PhpParser\Node\Expr\MethodCall^ {#446775
+var: PhpParser\Node\Expr\Variable^ {#446776
+name: "relationship"
#attributes: array:3 [
"startLine" => 30
"startFilePos" => 1235
"endFilePos" => 1247
]
}
+name: PhpParser\Node\Identifier^ {#446777
+name: "orderBy"
#attributes: array:3 [
"startLine" => 30
"startFilePos" => 1250
"endFilePos" => 1256
]
}
+args: array:2 [
0 => PhpParser\Node\Arg^ {#446778
+name: null
+value: PhpParser\Node\Scalar\String_^ {#446779
+value: "id"
#attributes: array:4 [
"startLine" => 30
"startFilePos" => 1258
"endFilePos" => 1261
"kind" => 1
]
}
+byRef: false
+unpack: false
#attributes: array:3 [
"startLine" => 30
"startFilePos" => 1258
"endFilePos" => 1261
]
}
1 => PhpParser\Node\Arg^ {#446780
+name: null
+value: PhpParser\Node\Scalar\String_^ {#446781
+value: "ASC"
#attributes: array:4 [
"startLine" => 30
"startFilePos" => 1264
"endFilePos" => 1268
"kind" => 1
]
}
+byRef: false
+unpack: false
#attributes: array:3 [
"startLine" => 30
"startFilePos" => 1264
"endFilePos" => 1268
]
}
]
#attributes: array:3 [
"startLine" => 30
"startFilePos" => 1235
"endFilePos" => 1269
]
}
"method_name_lowercase" => "orderby"
"called_method_name_lowercase" => null
] |
I dumped a bit and found that the
So maybe Psalm thinks that |
Describe the bug
The following causes both
MixedInferredReturnType
andMixedReturnStatement
.Same for
->orderByDesc('updated_at')
(which doesn't work, while->latest()
does).Impacted Versions
Additional context
(None.)
The text was updated successfully, but these errors were encountered: