mirror of
https://github.com/danog/PHP-Parser.git
synced 2024-11-26 20:04:48 +01:00
Improve error recovery in classes (#492)
This commit is contained in:
parent
e4a54fa90a
commit
7208b1c7ac
@ -514,7 +514,7 @@ static_var:
|
||||
;
|
||||
|
||||
class_statement_list:
|
||||
class_statement_list class_statement { push($1, $2); }
|
||||
class_statement_list class_statement { if ($2 !== null) { push($1, $2); } }
|
||||
| /* empty */ { init(); }
|
||||
;
|
||||
|
||||
@ -527,6 +527,7 @@ class_statement:
|
||||
{ $$ = Stmt\ClassMethod[$4, ['type' => $1, 'byRef' => $3, 'params' => $6, 'returnType' => $8, 'stmts' => $9]];
|
||||
$this->checkClassMethod($$, #1); }
|
||||
| T_USE class_name_list trait_adaptations { $$ = Stmt\TraitUse[$2, $3]; }
|
||||
| error { $$ = null; /* will be skipped */ }
|
||||
;
|
||||
|
||||
trait_adaptations:
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -953,3 +953,37 @@ array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
|
||||
class Foo {
|
||||
publi $foo;
|
||||
public $bar;
|
||||
}
|
||||
-----
|
||||
!!php7
|
||||
Syntax error, unexpected T_STRING from 4:5 to 4:9
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: Foo
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Property(
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: VarLikeIdentifier(
|
||||
name: bar
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
Loading…
Reference in New Issue
Block a user