[php-src] master: Zend: move type tests to common folder and add some more
| From: | Gina Peter Banyard | Date: | Wed, 14 Oct 2026 21:48:46 +0000 |
| Subject: | [php-src] master: Zend: move type tests to common folder and add some more | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-142292@lists.php.net to get a copy of this message | ||
Author: Gina Peter Banyard (Girgias)
Date: 2026-10-14T22:48:35+01:00
Commit: https://github.com/php/php-src/commit/40721797ba0aba2b596256f94dc1c529400aea0e
Raw diff: https://github.com/php/php-src/commit/40721797ba0aba2b596256f94dc1c529400aea0e.diff
Zend: move type tests to common folder and add some more
Changed paths:
A Zend/tests/type_declarations/bug62441.phpt
A Zend/tests/type_declarations/builtin/fully_qualified_array.phpt
A Zend/tests/type_declarations/builtin/fully_qualified_scalar.phpt
A Zend/tests/type_declarations/builtin/namespace_relative_array.phpt
A Zend/tests/type_declarations/builtin/namespace_relative_scalar.phpt
A Zend/tests/type_declarations/callable/fully_qualified_callable.phpt
A Zend/tests/type_declarations/callable/namespace_relative_callable.phpt
A Zend/tests/type_declarations/fq_nullable.phpt
A Zend/tests/type_declarations/or_null.phpt
D Zend/tests/typehints/bug62441.phpt
D Zend/tests/typehints/fq_nullable.phpt
D Zend/tests/typehints/fully_qualified_scalar.phpt
D Zend/tests/typehints/namespace_relative_scalar.phpt
D Zend/tests/typehints/or_null.phpt
Diff:
diff --git a/Zend/tests/typehints/bug62441.phpt b/Zend/tests/type_declarations/bug62441.phpt
similarity index 100%
rename from Zend/tests/typehints/bug62441.phpt
rename to Zend/tests/type_declarations/bug62441.phpt
diff --git a/Zend/tests/type_declarations/builtin/fully_qualified_array.phpt
b/Zend/tests/type_declarations/builtin/fully_qualified_array.phpt
new file mode 100644
index 000000000000..c0ba1051b98e
--- /dev/null
+++ b/Zend/tests/type_declarations/builtin/fully_qualified_array.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Fully qualified (leading backslash) array type name must fail
+--FILE--
+<?php
+
+function foo(\array $foo) {
+ var_dump($foo);
+}
+foo(1);
+
+?>
+--EXPECTF--
+Fatal error: Cannot use "array" as a type name as it is reserved in %s on line %d
diff --git a/Zend/tests/typehints/fully_qualified_scalar.phpt
b/Zend/tests/type_declarations/builtin/fully_qualified_scalar.phpt
similarity index 100%
rename from Zend/tests/typehints/fully_qualified_scalar.phpt
rename to Zend/tests/type_declarations/builtin/fully_qualified_scalar.phpt
diff --git a/Zend/tests/type_declarations/builtin/namespace_relative_array.phpt
b/Zend/tests/type_declarations/builtin/namespace_relative_array.phpt
new file mode 100644
index 000000000000..2480620074f7
--- /dev/null
+++ b/Zend/tests/type_declarations/builtin/namespace_relative_array.phpt
@@ -0,0 +1,11 @@
+--TEST--
+namespace\array is not a valid type declaration
+--FILE--
+<?php
+
+function test(namespace\array $i) {}
+test(0);
+
+?>
+--EXPECTF--
+Fatal error: Cannot use "array" as a type name as it is reserved in %s on line %d
diff --git a/Zend/tests/typehints/namespace_relative_scalar.phpt
b/Zend/tests/type_declarations/builtin/namespace_relative_scalar.phpt
similarity index 77%
rename from Zend/tests/typehints/namespace_relative_scalar.phpt
rename to Zend/tests/type_declarations/builtin/namespace_relative_scalar.phpt
index 096d04738719..12ff9939a4e1 100644
--- a/Zend/tests/typehints/namespace_relative_scalar.phpt
+++ b/Zend/tests/type_declarations/builtin/namespace_relative_scalar.phpt
@@ -1,5 +1,5 @@
--TEST--
-namespace\int is not a valid type hint
+namespace\int is not a valid type declaration
--FILE--
<?php
diff --git a/Zend/tests/type_declarations/callable/fully_qualified_callable.phpt
b/Zend/tests/type_declarations/callable/fully_qualified_callable.phpt
new file mode 100644
index 000000000000..405125b207a1
--- /dev/null
+++ b/Zend/tests/type_declarations/callable/fully_qualified_callable.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Fully qualified (leading backslash) callable type names must fail
+--FILE--
+<?php
+
+function test($i): \callable {}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use "callable" as a type name as it is reserved 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
new file mode 100644
index 000000000000..ccf67a0adc86
--- /dev/null
+++ b/Zend/tests/type_declarations/callable/namespace_relative_callable.phpt
@@ -0,0 +1,10 @@
+--TEST--
+namespace\callable is not a valid type declaration
+--FILE--
+<?php
+
+function test($i): namespace\callable {}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use "callable" as a type name as it is reserved in %s on line %d
diff --git a/Zend/tests/typehints/fq_nullable.phpt b/Zend/tests/type_declarations/fq_nullable.phpt
similarity index 100%
rename from Zend/tests/typehints/fq_nullable.phpt
rename to Zend/tests/type_declarations/fq_nullable.phpt
diff --git a/Zend/tests/typehints/or_null.phpt b/Zend/tests/type_declarations/or_null.phpt
similarity index 100%
rename from Zend/tests/typehints/or_null.phpt
rename to Zend/tests/type_declarations/or_null.phpt