Skip to content

Commit b3c7d7b

Browse files
committed
Fix "Arrow functions on the right hand side of |> must be parenthesized"
1 parent 138a73b commit b3c7d7b

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ protected function emitCallable($result, $callable) {
6060
$this->emitOne($result, $argument);
6161
$result->out->write(',');
6262
}
63+
} else {
64+
$result->out->write('(');
6365
}
6466

6567
// Emit closure invoking the callable expression
@@ -68,7 +70,12 @@ protected function emitCallable($result, $callable) {
6870
$result->out->write('(');
6971
$this->emitArguments($result, $pass);
7072
$result->out->write(')');
71-
$init && $result->out->write(']['.sizeof($init).']');
73+
74+
if ($init) {
75+
$result->out->write(']['.sizeof($init).']');
76+
} else {
77+
$result->out->write(')');
78+
}
7279
} else {
7380
parent::emitCallable($result, $callable);
7481
}

0 commit comments

Comments
 (0)