Skip to content

Commit

Permalink
Fix doctrine/lexer deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
norkunas authored and Hikariii committed Jan 29, 2024
1 parent 0c1aa4f commit bf5f27e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions src/Query/AST/Functions/AbstractJsonFunctionNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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:
Expand All @@ -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');
}
Expand All @@ -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);
}


Expand Down
2 changes: 1 addition & 1 deletion src/Query/AST/Functions/Mysql/JsonSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bf5f27e

Please sign in to comment.