Error recovery ----- ; ----- !!positions Syntax error, unexpected ';', expecting T_STRING or T_VARIABLE or '{' or '$' from 3:1 to 3:1 array( 0: Stmt_Expression[2:1 - 3:1]( expr: Expr_PropertyFetch[2:1 - 2:6]( var: Expr_Variable[2:1 - 2:4]( name: foo ) name: Expr_Error[3:1 - 2:6]( ) ) ) ) ----- } ----- !!positions Syntax error, unexpected '}', expecting T_STRING or T_VARIABLE or '{' or '$' from 4:1 to 4:1 array( 0: Stmt_Function[2:1 - 4:1]( attrGroups: array( ) byRef: false name: Identifier[2:10 - 2:12]( name: foo ) params: array( ) returnType: null stmts: array( 0: Stmt_Expression[3:5 - 3:10]( expr: Expr_PropertyFetch[3:5 - 3:10]( var: Expr_Variable[3:5 - 3:8]( name: bar ) name: Expr_Error[4:1 - 3:10]( ) ) ) ) ) ) ----- value $oopsAnotherValue->get() ]; $array = [ $value $oopsAnotherValue ]; $array = [ 'key' => $value $oopsAnotherValue ]; ----- !!php7 Syntax error, unexpected T_VARIABLE, expecting ',' or ']' or ')' from 3:18 to 3:34 Syntax error, unexpected T_VARIABLE, expecting ',' or ']' or ')' from 6:12 to 6:28 Syntax error, unexpected T_VARIABLE, expecting ',' or ']' or ')' from 9:21 to 9:37 array( 0: Stmt_Expression( expr: Expr_Assign( var: Expr_Variable( name: array ) expr: Expr_Array( items: array( 0: Expr_ArrayItem( key: null value: Expr_PropertyFetch( var: Expr_Variable( name: this ) name: Identifier( name: value ) ) byRef: false unpack: false ) 1: Expr_ArrayItem( key: null value: Expr_MethodCall( var: Expr_Variable( name: oopsAnotherValue ) name: Identifier( name: get ) args: array( ) ) byRef: false unpack: false ) ) ) ) ) 1: Stmt_Expression( expr: Expr_Assign( var: Expr_Variable( name: array ) expr: Expr_Array( items: array( 0: Expr_ArrayItem( key: null value: Expr_Variable( name: value ) byRef: false unpack: false ) 1: Expr_ArrayItem( key: null value: Expr_Variable( name: oopsAnotherValue ) byRef: false unpack: false ) ) ) ) ) 2: Stmt_Expression( expr: Expr_Assign( var: Expr_Variable( name: array ) expr: Expr_Array( items: array( 0: Expr_ArrayItem( key: Scalar_String( value: key ) value: Expr_Variable( name: value ) byRef: false unpack: false ) 1: Expr_ArrayItem( key: null value: Expr_Variable( name: oopsAnotherValue ) byRef: false unpack: false ) ) ) ) ) ) ----- foo = $s; } } class B { const X = 1 } ----- !!php7 Syntax error, unexpected T_PUBLIC, expecting ';' from 6:5 to 6:10 Syntax error, unexpected '}', expecting ';' from 12:1 to 12:1 array( 0: Stmt_Class( attrGroups: array( ) flags: 0 name: Identifier( name: A ) extends: null implements: array( ) stmts: array( 0: Stmt_Property( attrGroups: array( ) flags: MODIFIER_PRIVATE (4) type: null props: array( 0: Stmt_PropertyProperty( name: VarLikeIdentifier( name: foo ) default: null ) ) comments: array( 0: /** @var ?string */ ) ) 1: Stmt_ClassMethod( attrGroups: array( ) flags: MODIFIER_PUBLIC (1) byRef: false name: Identifier( name: __construct ) params: array( 0: Param( attrGroups: array( ) flags: 0 type: Identifier( name: string ) byRef: false variadic: false var: Expr_Variable( name: s ) default: null ) ) returnType: null stmts: array( 0: Stmt_Expression( expr: Expr_Assign( var: Expr_PropertyFetch( var: Expr_Variable( name: this ) name: Identifier( name: foo ) ) expr: Expr_Variable( name: s ) ) ) ) ) ) ) 1: Stmt_Class( attrGroups: array( ) flags: 0 name: Identifier( name: B ) extends: null implements: array( ) stmts: array( 0: Stmt_ClassConst( attrGroups: array( ) flags: 0 consts: array( 0: Const( name: Identifier( name: X ) value: Scalar_LNumber( value: 1 ) ) ) ) ) ) )