Can php have a mixed type hinting?

Mixed was accepted for PHP 8.0: https://wiki.php.net/rfc/mixed_type_v2

class B
{
    public function foo(mixed $value) {}
}

The feature you asked for is in the proposal phase. See PHP RFC: Union Types.

Update

Mixed type has been ultimately accepted and introduced in PHP 8 released in November 2020.


Union types RFC has been accepted and implemented for PHP 8.

Mixed type RFC is being voted on, but likely to pass at time of writing this answer.