Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions parser/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,10 @@ static void xx_ret_declare_statement(zval *ret, int type, zval *variables, xx_sc
parser_add_str(ret, "data-type", "bool");
break;

case XX_T_TYPE_OBJECT:
parser_add_str(ret, "data-type", "object");
break;

case XX_T_TYPE_STRING:
parser_add_str(ret, "data-type", "string");
break;
Expand All @@ -1073,10 +1077,6 @@ static void xx_ret_declare_statement(zval *ret, int type, zval *variables, xx_sc
parser_add_str(ret, "data-type", "mixed");
break;

case XX_T_TYPE_OBJECT:
parser_add_str(ret, "data-type", "object");
break;

default:
fprintf(stderr, "err 2?\n");
}
Expand Down
4 changes: 4 additions & 0 deletions parser/zephir.lemon
Original file line number Diff line number Diff line change
Expand Up @@ -1741,6 +1741,10 @@ xx_declare_statement(R) ::= TYPE_MIXED xx_declare_variable_list(L) DOTCOMMA . {
xx_ret_declare_statement(&R, XX_T_TYPE_MIXED, &L, status->scanner_state);
}

xx_declare_statement(R) ::= TYPE_OBJECT xx_declare_variable_list(L) DOTCOMMA . {
xx_ret_declare_statement(&R, XX_T_TYPE_OBJECT, &L, status->scanner_state);
}

xx_declare_variable_list(R) ::= xx_declare_variable_list(L) COMMA xx_declare_variable(V) . {
xx_ret_list(&R, &L, &V, status->scanner_state);
}
Expand Down
2 changes: 2 additions & 0 deletions tests/base/declare.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function test() {
string foo = "foobar";
array foo = [10,20,30];
var foo = 10;
object obj = new stdClass;
}
ZEP;

Expand Down Expand Up @@ -47,3 +48,4 @@ declare bool foo bool true
declare string foo string foobar
declare array foo array -
declare variable foo int 10
declare object obj new -