Scalar Types Are Unqualified
<?php
function foo(\array $array) {}
foo([]);
//TypeError: foo(): Argument #1 ($array) must be of type array, array given,
function goo(\callable $callable) {}
goo(strlen(...));
//TypeError: foo(): Argument #1 ($array) must be of type callable, array Colsure,
function hoo(\int $int) {}
hoo(1);
//Type declaration 'int' must be unqualifid
Scalar types like int or iterable should be used without a leading slash. However, there are exceptions. In PHP 8.3, types such as callable and array are still misinterpreted as class names, which can result in confusing or poorly worded error messages. This inconsistency remains a known issue in the language, affecting type declarations and error reporting for these specific cases, until PHP 8.5.
See Also
PHP Features
Last updated: 10 September 2026