Skip to content

Commit 1549178

Browse files
committed
Handle functions call
1 parent 05e2544 commit 1549178

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

examples/function.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
foo = [1, 2, 3];
2+
bar = 1;
3+
4+
return implode(' - ', array_slice(foo, bar));

examples/function.return

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2 - 3

src/JsPhpize/Parser/Visitor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ protected function visitVariable($token)
6565
}
6666
if ($next->type === '(') {
6767
$this->skip();
68+
$call = $token->value . '(' . $this->getExpression() . ')';
69+
$this->skip();
6870

69-
return $token->value . '(' . $this->getExpression() . ')';
71+
return $call;
7072
}
7173
if ($next->isAssignation()) {
7274
$this->skip();

0 commit comments

Comments
 (0)