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
I'm worndering why psalm is not able to infer that $b is X as well.
When I write a psalm plugin for detecting the return type of actual $object->{$prop}, I can infer the object argument to:
For the $a case: TNamedObject
For the $b case: TTemplateParam
(more information, see the provided plugin at: #9367 (comment))
Is it somehow possible from within a plugin to find the infered TNamedObject for the $b case as well?
Maybe this information is available or calculatable from somewhere in one of the various storages?
(This example contains an Accessor class, but it could as well be a higher-order function)
I recon this is not how the type-system works, but in this specific case it feels like it's something that should be calculateable - since the function argument is consuming a template that is resolvable from the parent's scope.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
Given this example: https://psalm.dev/r/f9aa48bf22
You can see that psalm results in:
I'm worndering why psalm is not able to infer that $b is
X
as well.When I write a psalm plugin for detecting the return type of actual
$object->{$prop}
, I can infer the object argument to:$a
case:TNamedObject
$b
case:TTemplateParam
(more information, see the provided plugin at: #9367 (comment))
Expand plugin code
Is it somehow possible from within a plugin to find the infered
TNamedObject
for the$b
case as well?Maybe this information is available or calculatable from somewhere in one of the various storages?
(This example contains an
Accessor
class, but it could as well be a higher-order function)I recon this is not how the type-system works, but in this specific case it feels like it's something that should be calculateable - since the function argument is consuming a template that is resolvable from the parent's scope.
Any clues are highly welcome :)
Beta Was this translation helpful? Give feedback.
All reactions