mixed Is Not No Type
<?php
class x {
public $p;
public mixed $q;
}
$x = new x;
var_dump($x->p);
var_dump($x->q); // Fatal error!
When a property is not typed, nor has a default value, it still may be accessed freely: its value is null. On the other hand, a mixed typed property may also hold anything, but it cannot be accessed until it was written once.
On development, it might be a good strategy to type properties mixed to spot any uninitialized usage and set them.
See Also
PHP Error Messages
PHP Features
Last updated: 10 September 2026