Replies: 1 comment 3 replies
-
With this signature:
PHPStan cannot know whether Make simpler signatures without union types. Accept |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
https://phpstan.org/r/5a22c0b2-f31f-4b8c-b703-389222111268
I'm dealing with some code that does some hacky
json_decode(json_encode(simplexml_load_string($xml)), true)
stuff, and invariably runs into the single-element-array case.I'm trying to properly annotate a method that helps in some of those cases. But I'm confused as to why PHPStan doesn't like it when the generic type is declared as possibly having inner array value.
Is this a bug, or am I not understanding something?
Beta Was this translation helpful? Give feedback.
All reactions