array And callable Cannot Be Absolute

array and callable cannot be an absolute type, with the leading backslash. This was not the case until PHP 8.5, and is now in harmony with other types like int.

PHP code

<?php

function foo() : \array {
    return [];
}

print_r(foo());

?>

Before

PHP Fatal error:  Uncaught TypeError: foo(): Return value must be of type array, array returned

Fatal error: Uncaught TypeError: foo(): Return value must be of type array, array returned

After

PHP Fatal error:  Cannot use array as a type name as it is reserved

Fatal error: Cannot use array as a type name as it is reserved

PHP version change

This behavior changed in 8.5

Error Messages