diff --git a/lib/Doctrine/ORM/Query/Parser.php b/lib/Doctrine/ORM/Query/Parser.php index e8c8104bd..48b13df64 100644 --- a/lib/Doctrine/ORM/Query/Parser.php +++ b/lib/Doctrine/ORM/Query/Parser.php @@ -304,21 +304,24 @@ class Parser $lookaheadType = $this->lexer->lookahead['type']; // Short-circuit on first condition, usually types match - if ($lookaheadType !== $token) { - // If parameter is not identifier (1-99) must be exact match - if ($token < Lexer::T_IDENTIFIER) { - $this->syntaxError($this->lexer->getLiteral($token)); - } + if ($lookaheadType === $token) { + $this->lexer->moveNext(); + return; + } - // If parameter is keyword (200+) must be exact match - if ($token > Lexer::T_IDENTIFIER) { - $this->syntaxError($this->lexer->getLiteral($token)); - } + // If parameter is not identifier (1-99) must be exact match + if ($token < Lexer::T_IDENTIFIER) { + $this->syntaxError($this->lexer->getLiteral($token)); + } - // If parameter is T_IDENTIFIER, then matches T_IDENTIFIER (100) and keywords (200+) - if ($token === Lexer::T_IDENTIFIER && $lookaheadType < Lexer::T_IDENTIFIER) { - $this->syntaxError($this->lexer->getLiteral($token)); - } + // If parameter is keyword (200+) must be exact match + if ($token > Lexer::T_IDENTIFIER) { + $this->syntaxError($this->lexer->getLiteral($token)); + } + + // If parameter is T_IDENTIFIER, then matches T_IDENTIFIER (100) and keywords (200+) + if ($token === Lexer::T_IDENTIFIER && $lookaheadType < Lexer::T_IDENTIFIER) { + $this->syntaxError($this->lexer->getLiteral($token)); } $this->lexer->moveNext(); @@ -959,20 +962,20 @@ class Parser if ($this->lexer->isNextToken(Lexer::T_FULLY_QUALIFIED_NAME)) { $this->match(Lexer::T_FULLY_QUALIFIED_NAME); - $schemaName = $this->lexer->token['value']; - } else if ($this->lexer->isNextToken(Lexer::T_IDENTIFIER)) { - $this->match(Lexer::T_IDENTIFIER); - - $schemaName = $this->lexer->token['value']; - } else { - $this->match(Lexer::T_ALIASED_NAME); - - list($namespaceAlias, $simpleClassName) = explode(':', $this->lexer->token['value']); - - $schemaName = $this->em->getConfiguration()->getEntityNamespace($namespaceAlias) . '\\' . $simpleClassName; + return $this->lexer->token['value']; } - return $schemaName; + if ($this->lexer->isNextToken(Lexer::T_IDENTIFIER)) { + $this->match(Lexer::T_IDENTIFIER); + + return $this->lexer->token['value']; + } + + $this->match(Lexer::T_ALIASED_NAME); + + [$namespaceAlias, $simpleClassName] = explode(':', $this->lexer->token['value']); + + return $this->em->getConfiguration()->getEntityNamespace($namespaceAlias) . '\\' . $simpleClassName; } /**