Array Has No Absolute Name

Classes may be used as type, with an optional leading \. This is not the case for scalar types, such as int or string, but it was the case for array. In PHP 8.5, it is now homogenized.

PHP code

<?php

function foo(\array $x = []) {}

?>

Before

PHP Fatal error:  Cannot use array as default value for parameter $x of type array in /codes/absoluteArrayName.php on line 3

Fatal error: Cannot use array as default value for parameter $x of type array in /codes/absoluteArrayName.php on line 3

After

PHP Fatal error:  Cannot use array as a type name as it is reserved in /codes/absoluteArrayName.php on line 3
Stack trace:
#0 {main}

Fatal error: Cannot use array as a type name as it is reserved in /codes/absoluteArrayName.php on line 3
Stack trace:
#0 {main}

PHP version change

This behavior changed in 8.5

Error Messages