Mixed And Untyped Are Not Compatible Types

no-email (Damien Seguy), Damien Seguy
Tue, 21 Nov 2023 00:00:00 +0000

A property typed mixed cannot be redefined later as untyped.
A property untyped cannot be redefined later as mixed.

Although, both syntax represent the same reality: any type goes.

Same for return type, in method compatibility situations. Although, it happens only when the parent is mixed, and the child untyped.

With return type, PHP does check if anything is returned with a type of ``mixed``, and not if it is untyped.