Skip to content

Commit 735d27b

Browse files
committed
Emit clone with expressions natively in PHP 8.5+
1 parent 1065b41 commit 735d27b

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ XP Compiler ChangeLog
33

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

6+
* Changed PHP 8.5 emitter to emit *clone with* expressions natively now
7+
that the RFC has been implemented
8+
(@thekid)
69
* Fixed the warning *Using null as an array offset is deprecated, use an
710
empty string instead* in PHP 8.5+
811
(@thekid)

src/main/php/lang/ast/emit/PHP85.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* @see https://wiki.php.net/rfc#php_85
2020
*/
2121
class PHP85 extends PHP {
22-
use RewriteBlockLambdaExpressions, RewriteCallableClone, RewriteCloneWith; // TODO: Remove once PR is merged!
22+
use RewriteBlockLambdaExpressions, RewriteCallableClone;
2323

2424
public $targetVersion= 80500;
2525

src/test/php/lang/ast/unittest/emit/PHP85Test.class.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,12 @@ public function nullsafepipe_operator() {
2323
$this->emit('"test" ?|> strtoupper(...);')
2424
);
2525
}
26+
27+
#[Test]
28+
public function clone_with() {
29+
Assert::equals(
30+
'clone($this,["name"=>strtoupper($this->name),]);',
31+
$this->emit('clone($this, ["name" => strtoupper($this->name)]);')
32+
);
33+
}
2634
}

0 commit comments

Comments
 (0)