mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-30 04:29:15 +01:00
Support recovery for new without class name
This commit is contained in:
parent
6db8d9d5a5
commit
c0630f8169
@ -667,6 +667,7 @@ name:
|
||||
class_name_reference:
|
||||
class_name { $$ = $1; }
|
||||
| new_variable { $$ = $1; }
|
||||
| error { $$ = Expr\Error[]; $this->errorState = 2; }
|
||||
;
|
||||
|
||||
class_name_or_var:
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -279,4 +279,49 @@ array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
new T
|
||||
-----
|
||||
Syntax error, unexpected EOF from 2:6 to 2:6
|
||||
array(
|
||||
0: Expr_New(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: T
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
new
|
||||
-----
|
||||
!!php7
|
||||
Syntax error, unexpected EOF from 2:4 to 2:4
|
||||
array(
|
||||
0: Expr_New(
|
||||
class: Expr_Error(
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
$foo instanceof
|
||||
-----
|
||||
!!php7
|
||||
Syntax error, unexpected EOF from 2:16 to 2:16
|
||||
array(
|
||||
0: Expr_Instanceof(
|
||||
expr: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
class: Expr_Error(
|
||||
)
|
||||
)
|
||||
)
|
@ -3,6 +3,21 @@ New without a class
|
||||
<?php
|
||||
new;
|
||||
-----
|
||||
!!php5
|
||||
Syntax error, unexpected ';' from 2:4 to 2:4
|
||||
array(
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
new;
|
||||
-----
|
||||
!!php7
|
||||
Syntax error, unexpected ';' from 2:4 to 2:4
|
||||
array(
|
||||
0: Expr_New(
|
||||
class: Expr_Error(
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
Loading…
Reference in New Issue
Block a user