From 0ad6285cfe08a25488f1d3701bb59b9d90bbb0b1 Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Sat, 11 Jul 2026 18:07:19 +0800 Subject: [PATCH] test(aot): add trait private property write inherited test case - Create new test file for trait method writing injected private property on child object - Add trait PrivatePropertyWriter with private array property and items method - Implement PropertyOwner class using the trait - Create ChildPropertyOwner class extending PropertyOwner - Add main function to test the inherited private property access - Define expected output for the array dump result --- ...rait-private-property-write-inherited.phpt | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/aot/basic/trait-private-property-write-inherited.phpt diff --git a/tests/aot/basic/trait-private-property-write-inherited.phpt b/tests/aot/basic/trait-private-property-write-inherited.phpt new file mode 100644 index 00000000..5bdbc946 --- /dev/null +++ b/tests/aot/basic/trait-private-property-write-inherited.phpt @@ -0,0 +1,44 @@ +--TEST-- +trait method writes injected private property on child object +--SKIPIF-- +--FILE-- +items !== null) { + return $this->items; + } + return $this->items = [1, 3, 4]; + } +} + +class PropertyOwner +{ + use PrivatePropertyWriter; +} + +class ChildPropertyOwner extends PropertyOwner +{ +} + +function main(): void +{ + $object = new ChildPropertyOwner(); + var_dump($object->items()); +} + +?> +--EXPECT-- +array(3) { + [0]=> + int(1) + [1]=> + int(3) + [2]=> + int(4) +}