Skip to content

Commit 1428196

Browse files
committed
Test native hooks / asymmetric visibility emitter for PHP 8.4
1 parent ab07d7c commit 1428196

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

ChangeLog.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ XP Compiler ChangeLog
33

44
## ?.?.? / ????-??-??
55

6-
* Added PHP 8.4 emitter which feature-checks for both property hooks
7-
and asymmetric visibility RFCs, deciding whether to natively emit or
8-
use virtual properties
6+
* Added PHP 8.4 emitter which natively emits property hooks and asymmetric
7+
visibility syntax
98
(@thekid)
109
* Changed emitter to use native readonly classes in PHP 8.3, fixing an
1110
inconsistency with accessing undefined properties
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php namespace lang\ast\unittest\emit;
2+
3+
use lang\ast\emit\Type;
4+
use test\{Assert, Test};
5+
6+
class PHP84Test extends EmittingTest {
7+
8+
/** @return string */
9+
protected function runtime() { return 'php:8.4.0'; }
10+
11+
#[Test]
12+
public function property_hooks() {
13+
Assert::matches(
14+
'/\$test{get=>"Test";}/',
15+
$this->emit('class %T { public $test { get => "Test"; } }')
16+
);
17+
}
18+
19+
#[Test]
20+
public function asymmetric_visibility() {
21+
Assert::matches(
22+
'/public private\(set\) string \$test/',
23+
$this->emit('class %T { public private(set) string $test; }')
24+
);
25+
}
26+
}

0 commit comments

Comments
 (0)