From 98321138cedf5983f2ae44375ce00fd2e9e56bc3 Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Thu, 27 Aug 2026 15:39:35 +0800 Subject: [PATCH] test(gen_stub): cover namespaced composite property types --- ...namespaced-composite-property-arginfo.phpt | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 tests/compiler/type_decl/namespaced-composite-property-arginfo.phpt diff --git a/tests/compiler/type_decl/namespaced-composite-property-arginfo.phpt b/tests/compiler/type_decl/namespaced-composite-property-arginfo.phpt new file mode 100644 index 00000000..7d034fff --- /dev/null +++ b/tests/compiler/type_decl/namespaced-composite-property-arginfo.phpt @@ -0,0 +1,62 @@ +--TEST-- +Namespaced union and intersection properties generate valid arginfo identifiers +--FILE-- +union = $union; + $this->intersection = $intersection; + } + } + + function run(): void + { + $both = new Both(); + $holder = new Holder(new Alternative(), $both); + + echo (new \ReflectionProperty(Holder::class, 'union'))->getType(), "\n"; + echo (new \ReflectionProperty(Holder::class, 'intersection'))->getType(), "\n"; + var_dump($holder->union instanceof Alternative); + var_dump($holder->intersection instanceof Both); + + $holder->union = $both; + var_dump($holder->union instanceof Both); + } +} + +namespace { + function main(): void + { + \NamespacedArginfo\run(); + } +} +?> +--EXPECT-- +NamespacedArginfo\Left|NamespacedArginfo\Alternative +NamespacedArginfo\Left&NamespacedArginfo\Right +bool(true) +bool(true) +bool(true)