From bf5f27ef5dea91713ca38ac9d7d2cda8686a449c Mon Sep 17 00:00:00 2001 From: Tomas Date: Tue, 23 Jan 2024 08:39:23 +0200 Subject: [PATCH] Fix doctrine/lexer deprecations --- composer.json | 5 +++-- src/Query/AST/Functions/AbstractJsonFunctionNode.php | 8 ++++---- src/Query/AST/Functions/Mysql/JsonSearch.php | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index b9056a4..085da58 100644 --- a/composer.json +++ b/composer.json @@ -25,8 +25,9 @@ "require": { "php": "^7.3 || ^8.0", "ext-pdo": "*", - "doctrine/orm": "^2.0", - "doctrine/dbal": "^3.0" + "doctrine/dbal": "^3.0", + "doctrine/lexer": "^2.0 || ^3.0", + "doctrine/orm": "^2.14" }, "require-dev": { "doctrine/coding-standard": "^8.0 || ^9.0", diff --git a/src/Query/AST/Functions/AbstractJsonFunctionNode.php b/src/Query/AST/Functions/AbstractJsonFunctionNode.php index cc46ff4..d8f96ce 100644 --- a/src/Query/AST/Functions/AbstractJsonFunctionNode.php +++ b/src/Query/AST/Functions/AbstractJsonFunctionNode.php @@ -109,7 +109,7 @@ protected function parseArguments(Parser $parser, array $argumentTypes, bool $ar protected function parseStringLiteral(Parser $parser): Literal { $lexer = $parser->getLexer(); - $lookaheadType = $lexer->lookahead['type']; + $lookaheadType = $lexer->lookahead->type; if ($lookaheadType != Lexer::T_STRING) { $parser->syntaxError('string'); @@ -126,7 +126,7 @@ protected function parseStringLiteral(Parser $parser): Literal protected function parseAlphaNumericLiteral(Parser $parser): Literal { $lexer = $parser->getLexer(); - $lookaheadType = $lexer->lookahead['type']; + $lookaheadType = $lexer->lookahead->type; switch ($lookaheadType) { case Lexer::T_STRING: @@ -137,7 +137,7 @@ protected function parseAlphaNumericLiteral(Parser $parser): Literal $lexer->isNextToken(Lexer::T_INTEGER) ? Lexer::T_INTEGER : Lexer::T_FLOAT ); - return new Literal(Literal::NUMERIC, $lexer->token['value']); + return new Literal(Literal::NUMERIC, $lexer->token->value); default: $parser->syntaxError('numeric'); } @@ -146,7 +146,7 @@ protected function parseAlphaNumericLiteral(Parser $parser): Literal private function matchStringLiteral(Parser $parser, Lexer $lexer): Literal { $parser->match(Lexer::T_STRING); - return new Literal(Literal::STRING, $lexer->token['value']); + return new Literal(Literal::STRING, $lexer->token->value); } diff --git a/src/Query/AST/Functions/Mysql/JsonSearch.php b/src/Query/AST/Functions/Mysql/JsonSearch.php index 99cde70..4882823 100755 --- a/src/Query/AST/Functions/Mysql/JsonSearch.php +++ b/src/Query/AST/Functions/Mysql/JsonSearch.php @@ -66,7 +66,7 @@ public function parse(Parser $parser): void */ protected function parsePathMode(Parser $parser) { - $value = $parser->getLexer()->lookahead['value']; + $value = $parser->getLexer()->lookahead->value; if (strcasecmp(self::MODE_ONE, $value) === 0) { $this->mode = self::MODE_ONE;