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
Right now, Psalm's type system cannot store those two informations at the same time:
class name
properties names/values
For known object with known properties, the class name is enough to describe the whole object, however, for dynamic object where properties are not known, this is an issue.
Psalm's type system could probably be enhanced in order to store both informations but if we have to choose, I prefer keeping the current behaviour (it's better to be able to track property name and values instead of tracking the class name for stdClass, cases where we specifically want to only allow stdClass and no other object are rare I think).
The plan is to eventually support this by using intersections, but Psalm's intersection support really needs rebuilt from the ground up for this to work, and then a significant portion of the analysis needs to be updated to correctly account for intersections.
The following code (https://psalm.dev/r/45cf3afbc3):
started producing an error:
Which is funny, cause the actual output is:
This did not happen in psalm 4.23.0, but happens in 4.26.0
My guess is that the regression happened in 4.24.0 and possibly caused by #7935
The text was updated successfully, but these errors were encountered: