Type mixed cannot be marked as nullable since mixed already includes null

Description

mixed is a special type, that represents all the available types, include null.

Example

<?php

function foo(?mixed $i = null) {}

?>

Solutions

  • Remove the ? type with mixed.

  • Keep the ? type, and replace mixed, with some other type.