Commit f99f5c4ab2a for php

commit f99f5c4ab2aa2e109c579458ae54b1ce7787549e
Author: Gina Peter Banyard <girgias@php.net>
Date:   Sat Sep 19 14:54:01 2026 +0100

    Zend: improve error message when using array or callable as types with namespace components

diff --git a/Zend/tests/type_declarations/builtin/fully_qualified_array.phpt b/Zend/tests/type_declarations/builtin/fully_qualified_array.phpt
index c0ba1051b98..5af78a1bdb1 100644
--- a/Zend/tests/type_declarations/builtin/fully_qualified_array.phpt
+++ b/Zend/tests/type_declarations/builtin/fully_qualified_array.phpt
@@ -10,4 +10,4 @@ function foo(\array $foo) {

 ?>
 --EXPECTF--
-Fatal error: Cannot use "array" as a type name as it is reserved in %s on line %d
+Fatal error: Type declaration 'array' must be unqualified in %s on line %d
diff --git a/Zend/tests/type_declarations/builtin/namespace_relative_array.phpt b/Zend/tests/type_declarations/builtin/namespace_relative_array.phpt
index 2480620074f..8db15fe5269 100644
--- a/Zend/tests/type_declarations/builtin/namespace_relative_array.phpt
+++ b/Zend/tests/type_declarations/builtin/namespace_relative_array.phpt
@@ -8,4 +8,4 @@ function test(namespace\array $i) {}

 ?>
 --EXPECTF--
-Fatal error: Cannot use "array" as a type name as it is reserved in %s on line %d
+Fatal error: Type declaration 'array' must be unqualified in %s on line %d
diff --git a/Zend/tests/type_declarations/callable/fully_qualified_callable.phpt b/Zend/tests/type_declarations/callable/fully_qualified_callable.phpt
index 405125b207a..9570ab8c82a 100644
--- a/Zend/tests/type_declarations/callable/fully_qualified_callable.phpt
+++ b/Zend/tests/type_declarations/callable/fully_qualified_callable.phpt
@@ -7,4 +7,4 @@ function test($i): \callable {}

 ?>
 --EXPECTF--
-Fatal error: Cannot use "callable" as a type name as it is reserved in %s on line %d
+Fatal error: Type declaration 'callable' must be unqualified in %s on line %d
diff --git a/Zend/tests/type_declarations/callable/namespace_relative_callable.phpt b/Zend/tests/type_declarations/callable/namespace_relative_callable.phpt
index ccf67a0adc8..45afcf6e5b0 100644
--- a/Zend/tests/type_declarations/callable/namespace_relative_callable.phpt
+++ b/Zend/tests/type_declarations/callable/namespace_relative_callable.phpt
@@ -7,4 +7,4 @@ function test($i): namespace\callable {}

 ?>
 --EXPECTF--
-Fatal error: Cannot use "callable" as a type name as it is reserved in %s on line %d
+Fatal error: Type declaration 'callable' must be unqualified in %s on line %d
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 032105019a2..e4df321fb5e 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -281,6 +281,9 @@ static const builtin_type_info builtin_types[] = {
 	{ZEND_STRL("iterable"), IS_ITERABLE},
 	{ZEND_STRL("object"), IS_OBJECT},
 	{ZEND_STRL("mixed"), IS_MIXED},
+	/* Should be handled as ZEND_TYPE_ASTs but it may have a namespace component */
+	{ZEND_STRL("array"), IS_ARRAY},
+	{ZEND_STRL("callable"), IS_CALLABLE},
 	{ZEND_STRL("static"), IS_STATIC},
 	{NULL, 0, IS_UNDEF}
 };
@@ -7747,7 +7750,8 @@ static zend_type zend_compile_single_typename(zend_ast *ast)
 					ZSTR_VAL(zend_string_tolower(type_name)));
 			}

-			ZEND_ASSERT(type_code != IS_STATIC && "unqualified static type should have been handled by ZEND_AST_TYPE branch");
+			ZEND_ASSERT(type_code != IS_STATIC && type_code != IS_ARRAY && type_code != IS_CALLABLE
+				&& "unqualified array/callable/static type should have been handled by ZEND_AST_TYPE branch");

 			/* Transform iterable into a type union alias */
 			if (type_code == IS_ITERABLE) {