Skip to content

Commit

Permalink
Fixed string interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
sorinsarca committed Apr 9, 2021
1 parent 06b4961 commit 85fec0b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ReflectionClosure.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public function getCode()
case T_CURLY_OPEN:
case T_DOLLAR_OPEN_CURLY_BRACES:
case '{':
$code .= '{';
$code .= is_array($token) ? $token[1] : $token;
$open++;
break;
case '}':
Expand Down
8 changes: 8 additions & 0 deletions tests/ReflectionClosureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,12 @@ public function testParentInsideClosure()
$this->assertEquals($e1, $this->c($f1));
$this->assertEquals($e2, $this->c($f2));
}

public function testInterpolation1()
{
$f1 = function() { return "${foo}${bar}{$foobar}"; };
$e1 = 'function() { return "${foo}${bar}{$foobar}"; }';

$this->assertEquals($e1, $this->c($f1));
}
}

0 comments on commit 85fec0b

Please sign in to comment.