r/PHPhelp • u/notkingkero • Aug 22 '25
Difference between array, array<mixed> and mixed[]?
In my head, array, array<mixed> and mixed[] represents the same thing.
However, there seems to be a difference between array|\Foo[], array<mixed>|\Foo[] and mixed[]|\Foo[] (see here in PHPStan playground). Is my original assumption wrong or the type detection buggy?
3
Upvotes
View all comments
Show parent comment
1
u/notkingkero Aug 22 '25
Makes sense. But why is the dumpType of `array|string[]` then `list<string>` and not `array<mixed>|list<string>`?