From 9cb6267caebcc97f59d3b6a7f2eb9e713cbfcfa7 Mon Sep 17 00:00:00 2001 From: Stephen Maiorana Date: Mon, 24 Jan 2022 11:14:38 -0500 Subject: [PATCH] Addresses typed class properties. * #73: Conversion of a Class Property's Modifier Not Compatible with Typed Class Properties --- grammar_parser/reader.inc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/grammar_parser/reader.inc b/grammar_parser/reader.inc index f54ee3e..7d96280 100644 --- a/grammar_parser/reader.inc +++ b/grammar_parser/reader.inc @@ -518,8 +518,18 @@ class PGPReader extends PGPParser { $this->functionCalls[] = &$node/*->data*/; } else { // TODO Added 2010-01-27 + if ($this->previousTokenValue() == "?") { + $token = &$this->tokens[key($this->tokens)]; + $token[1] = $this->previousTokenValue() . $token[1]; + } + prev($this->tokens); $node->data = $this->buildAssignment($modifiers); + + // Allow proper handling of typed class properties introduced in + // PHP 7.4 by preventing modifiers from stacking against future + // expressions. + $modifiers = array(); } } break; @@ -2044,7 +2054,7 @@ class PGPReader extends PGPParser { default: prev($this->tokens); $expression->values->insertLast($this->buildExpression(array(',', ';'))); -// $expression->warning = 'unexected syntax in ' . __METHOD__ . '(' . __LINE__ . ')'; +// $expression->warning = 'unexpected syntax in ' . __METHOD__ . '(' . __LINE__ . ')'; // $expression->extra = $this->cleanToken(); // return $expression; break;