Skip to content

Commit

Permalink
Verify first-class callables can be used as parameter defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Nov 2, 2024
1 parent 11b7f1a commit 268c79e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/test/php/lang/ast/unittest/emit/ParameterTest.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ public function closure_as_default() {
Assert::equals(2, $function(1));
}

#[Test]
public function first_class_callable_as_default() {
$function= $this->param('$op= strlen(...)')->default();
Assert::equals(4, $function('Test'));
}

#[Test]
public function trailing_comma_allowed() {
$p= $this->declare('class %T { public function fixture($param, ) { } }')
Expand Down

0 comments on commit 268c79e

Please sign in to comment.