Skip to content

Commit 61c4476

Browse files
committed
Show how the ... placeholder may appear in the middle of arguments
1 parent 4bc33f5 commit 61c4476

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

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

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -276,19 +276,6 @@ public function run() {
276276
Assert::equals(['ONE', 'TWO'], $f(['One', 'Two']));
277277
}
278278

279-
#[Test, Runtime(php: '>=8.5.0')]
280-
public function partial_function_application_variadic_optional_by_ref() {
281-
$f= $this->run('class %T {
282-
public function run() {
283-
return str_replace("test", ...);
284-
}
285-
}');
286-
287-
$count= 0;
288-
Assert::equals('ok', $f('ok', 'test', $count));
289-
Assert::equals(1, $count);
290-
}
291-
292279
#[Test]
293280
public function partial_function_application_order() {
294281
[$result, $invokations]= $this->run('class %T {
@@ -358,6 +345,19 @@ public function run() {
358345
Assert::equals('ok.', $f('test.'));
359346
}
360347

348+
#[Test, Runtime(php: '>=8.5.0')]
349+
public function partial_function_application_variadic_optional_by_ref() {
350+
$f= $this->run('class %T {
351+
public function run() {
352+
return str_replace("test", "ok", ...);
353+
}
354+
}');
355+
356+
$count= 0;
357+
Assert::equals('ok.', $f('test.', $count));
358+
Assert::equals(1, $count);
359+
}
360+
361361
#[Test, Runtime(php: '>=8.5.0')]
362362
public function partial_function_application_with_named() {
363363
$r= $this->run('class %T {
@@ -369,4 +369,16 @@ public function run() {
369369
}');
370370
Assert::equals('ok.', $r);
371371
}
372+
373+
#[Test, Runtime(php: '>=8.5.0')]
374+
public function partial_function_application_variadic_before_named() {
375+
$r= $this->run('class %T {
376+
377+
public function run() {
378+
$f= str_replace("test", ..., subject: ?);
379+
return $f("ok", "test.");
380+
}
381+
}');
382+
Assert::equals('ok.', $r);
383+
}
372384
}

0 commit comments

Comments
 (0)