Skip to content

Commit 8474005

Browse files
committed
Allow truncated opening function
1 parent 785311d commit 8474005

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/JsPhpize/Parser/Parser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,19 +279,19 @@ protected function parseFunction($token)
279279
{
280280
$function = new Block('function');
281281
$token = $this->get(0);
282-
if ($token->type === 'variable') {
282+
if ($token && $token->type === 'variable') {
283283
$this->skip();
284284
$token = $this->get(0);
285285
}
286286

287-
if (!$token->is('(')) {
287+
if ($token && !$token->is('(')) {
288288
throw $this->unexpected($token);
289289
}
290290

291291
$this->skip();
292292
$function->setValue($this->parseParentheses());
293293
$token = $this->get(0);
294-
if (!$token->is('{')) {
294+
if ($token && !$token->is('{')) {
295295
throw $this->unexpected($token);
296296
}
297297

0 commit comments

Comments
 (0)