Skip to content

Commit

Permalink
[POC] usage of new TokenType
Browse files Browse the repository at this point in the history
  • Loading branch information
connorhu committed Feb 6, 2024
1 parent 1f307bb commit a5fba21
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@
],
"require": {
"php": "^7.2 || ^8.0",
"doctrine/orm": "^2.15 || ^3.0"
"doctrine/orm": "dev-feature/token-type-bridge"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/connorhu/doctrine2"
}
],
"require-dev": {
"doctrine/annotations": "^1.14 || ^2",
"doctrine/coding-standard": "^9.0.2 || ^12.0",
Expand Down
9 changes: 3 additions & 6 deletions src/Query/Mysql/Acos.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace DoctrineExtensions\Query\Mysql;

use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TokenType;
Expand All @@ -23,13 +22,11 @@ public function getSql(SqlWalker $sqlWalker): string

public function parse(Parser $parser): void
{
$orm3 = class_exists(TokenType::class);

$parser->match($orm3 ? TokenType::T_IDENTIFIER : Lexer::T_IDENTIFIER);
$parser->match($orm3 ? TokenType::T_OPEN_PARENTHESIS : Lexer::T_OPEN_PARENTHESIS);
$parser->match(TokenType::T_IDENTIFIER);
$parser->match(TokenType::T_OPEN_PARENTHESIS);

$this->arithmeticExpression = $parser->SimpleArithmeticExpression();

$parser->match($orm3 ? TokenType::T_CLOSE_PARENTHESIS : Lexer::T_CLOSE_PARENTHESIS);
$parser->match(TokenType::T_CLOSE_PARENTHESIS);
}
}

0 comments on commit a5fba21

Please sign in to comment.