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
As you can see, in lines 19 and 23, the exact same thing happens: We're setting a nested object property.
Up until line 19, everything is fine, and Psalm happily fetches the nested property value in line 18 and also allows to set the value in line 19. However, in line 23, it no longer seems to know the type of the bar property; it inferred mixed.
Now, there are a lot of different things you can do to break it even more, or partially unbreak it.
For example, moving line 23 before the if will not trigger anything.
Happy to provide additional information, but it looks like Psalm discards (partial) information after a manual comparison inside a control structure (or something like that), and thus falls back to mixed, which then leads to various issues like MixedPropertyAssignment, MixedPropertyFetch, MixedArrayAssignment, MixedOperand etc.
The text was updated successfully, but these errors were encountered:
Consider the following snippet:
As you can see, in lines 19 and 23, the exact same thing happens: We're setting a nested object property.
Up until line 19, everything is fine, and Psalm happily fetches the nested property value in line 18 and also allows to set the value in line 19. However, in line 23, it no longer seems to know the type of the
bar
property; it inferredmixed
.Now, there are a lot of different things you can do to break it even more, or partially unbreak it.
For example, moving line 23 before the
if
will not trigger anything.Or storing the conditional in a variable will make the issue go away too:
Funnily, using
is_null
instead of manually comparing withnull
will work, too, even when inline:Or
empty()
or!isset()
etc.Is there anything I am doing wrong? Is Psalm?
Does that look like a bug to you too?
Happy to provide additional information, but it looks like Psalm discards (partial) information after a manual comparison inside a control structure (or something like that), and thus falls back to
mixed
, which then leads to various issues likeMixedPropertyAssignment
,MixedPropertyFetch
,MixedArrayAssignment
,MixedOperand
etc.The text was updated successfully, but these errors were encountered: