Created
April 18, 2014 08:16
-
-
Save krakjoe/f54f6ba37e3eeab5f705 to your computer and use it in GitHub Desktop.
Suggestion 5 compat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y | |
index 6cb28d3..4fd20da 100644 | |
--- a/Zend/zend_language_parser.y | |
+++ b/Zend/zend_language_parser.y | |
@@ -163,6 +163,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*); | |
%token T_FUNCTION "function (T_FUNCTION)" | |
%token T_CONST "const (T_CONST)" | |
%token T_RETURN "return (T_RETURN)" | |
+%token T_RETURNS "returns (T_RETURNS)" | |
%token T_TRY "try (T_TRY)" | |
%token T_CATCH "catch (T_CATCH)" | |
%token T_FINALLY "finally (T_FINALLY)" | |
@@ -416,9 +417,14 @@ function_return_type: | |
| fully_qualified_class_name { $$ = $1; } | |
; | |
+function_returns: | |
+ ':' | |
+ | T_RETURNS | |
+; | |
+ | |
function_return_hint: | |
- /* empty */ { $$.op_type = IS_UNUSED; } | |
- | ':' function_return_type { zend_do_function_return_hint(&$2 TSRMLS_CC); } | |
+ /* empty */ { $$.op_type = IS_UNUSED; } | |
+ | function_returns function_return_type { zend_do_function_return_hint(&$2 TSRMLS_CC); } | |
; | |
unticked_function_declaration_statement: | |
diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l | |
index 4f50658..839baf3 100644 | |
--- a/Zend/zend_language_scanner.l | |
+++ b/Zend/zend_language_scanner.l | |
@@ -1031,6 +1031,10 @@ NEWLINE ("\r"|"\n"|"\r\n") | |
return T_RETURN; | |
} | |
+<ST_IN_SCRIPTING>"returns" { | |
+ return T_RETURNS; | |
+} | |
+ | |
<ST_IN_SCRIPTING>"yield" { | |
return T_YIELD; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment