From 1428196c908fb1812f0931a77210696941f6c8fb Mon Sep 17 00:00:00 2001 From: Timm Friebe Date: Sat, 31 Aug 2024 11:49:51 +0200 Subject: [PATCH] Test native hooks / asymmetric visibility emitter for PHP 8.4 --- ChangeLog.md | 5 ++-- .../ast/unittest/emit/PHP84Test.class.php | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100755 src/test/php/lang/ast/unittest/emit/PHP84Test.class.php diff --git a/ChangeLog.md b/ChangeLog.md index 83ba14b2..3166c6e7 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -3,9 +3,8 @@ XP Compiler ChangeLog ## ?.?.? / ????-??-?? -* Added PHP 8.4 emitter which feature-checks for both property hooks - and asymmetric visibility RFCs, deciding whether to natively emit or - use virtual properties +* Added PHP 8.4 emitter which natively emits property hooks and asymmetric + visibility syntax (@thekid) * Changed emitter to use native readonly classes in PHP 8.3, fixing an inconsistency with accessing undefined properties diff --git a/src/test/php/lang/ast/unittest/emit/PHP84Test.class.php b/src/test/php/lang/ast/unittest/emit/PHP84Test.class.php new file mode 100755 index 00000000..69c55acd --- /dev/null +++ b/src/test/php/lang/ast/unittest/emit/PHP84Test.class.php @@ -0,0 +1,26 @@ +"Test";}/', + $this->emit('class %T { public $test { get => "Test"; } }') + ); + } + + #[Test] + public function asymmetric_visibility() { + Assert::matches( + '/public private\(set\) string \$test/', + $this->emit('class %T { public private(set) string $test; }') + ); + } +} \ No newline at end of file