Skip to content

Commit

Permalink
Migrate Parser to PHP 8
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Feb 7, 2023
1 parent 0f25ae4 commit 4dd88d6
Show file tree
Hide file tree
Showing 12 changed files with 162 additions and 521 deletions.
7 changes: 2 additions & 5 deletions lib/Doctrine/ORM/Query/AST/AggregateExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@

class AggregateExpression extends Node
{
/**
* @param PathExpression|SimpleArithmeticExpression $pathExpression
* @param bool $isDistinct Some aggregate expressions support distinct, eg COUNT.
*/
/** @param bool $isDistinct Some aggregate expressions support distinct, eg COUNT. */
public function __construct(
public string $functionName,
public $pathExpression,
public Node|string $pathExpression,
public bool $isDistinct,
) {
}
Expand Down
3 changes: 1 addition & 2 deletions lib/Doctrine/ORM/Query/AST/ArithmeticExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
*/
class ArithmeticExpression extends Node
{
/** @var SimpleArithmeticExpression|null */
public $simpleArithmeticExpression;
public Node|string|null $simpleArithmeticExpression = null;

/** @var Subselect|null */
public $subselect;
Expand Down
5 changes: 2 additions & 3 deletions lib/Doctrine/ORM/Query/AST/Functions/AbsFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Doctrine\ORM\Query\AST\Functions;

use Doctrine\ORM\Query\AST\SimpleArithmeticExpression;
use Doctrine\ORM\Query\AST\Node;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TokenType;
Expand All @@ -16,8 +16,7 @@
*/
class AbsFunction extends FunctionNode
{
/** @var SimpleArithmeticExpression */
public $simpleArithmeticExpression;
public Node|string $simpleArithmeticExpression;

public function getSql(SqlWalker $sqlWalker): string
{
Expand Down
8 changes: 3 additions & 5 deletions lib/Doctrine/ORM/Query/AST/Functions/LocateFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Doctrine\ORM\Query\AST\Functions;

use Doctrine\ORM\Query\AST\Node;
use Doctrine\ORM\Query\AST\SimpleArithmeticExpression;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TokenType;
Expand All @@ -17,11 +16,10 @@
*/
class LocateFunction extends FunctionNode
{
public Node $firstStringPrimary;
public Node $secondStringPrimary;
public Node|string $firstStringPrimary;
public Node|string $secondStringPrimary;

/** @var SimpleArithmeticExpression|bool */
public $simpleArithmeticExpression = false;
public Node|string|bool $simpleArithmeticExpression = false;

public function getSql(SqlWalker $sqlWalker): string
{
Expand Down
9 changes: 3 additions & 6 deletions lib/Doctrine/ORM/Query/AST/Functions/ModFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Doctrine\ORM\Query\AST\Functions;

use Doctrine\ORM\Query\AST\SimpleArithmeticExpression;
use Doctrine\ORM\Query\AST\Node;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TokenType;
Expand All @@ -16,11 +16,8 @@
*/
class ModFunction extends FunctionNode
{
/** @var SimpleArithmeticExpression */
public $firstSimpleArithmeticExpression;

/** @var SimpleArithmeticExpression */
public $secondSimpleArithmeticExpression;
public Node|string $firstSimpleArithmeticExpression;
public Node|string $secondSimpleArithmeticExpression;

public function getSql(SqlWalker $sqlWalker): string
{
Expand Down
5 changes: 2 additions & 3 deletions lib/Doctrine/ORM/Query/AST/Functions/SqrtFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Doctrine\ORM\Query\AST\Functions;

use Doctrine\ORM\Query\AST\SimpleArithmeticExpression;
use Doctrine\ORM\Query\AST\Node;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TokenType;
Expand All @@ -18,8 +18,7 @@
*/
class SqrtFunction extends FunctionNode
{
/** @var SimpleArithmeticExpression */
public $simpleArithmeticExpression;
public Node|string $simpleArithmeticExpression;

public function getSql(SqlWalker $sqlWalker): string
{
Expand Down
8 changes: 2 additions & 6 deletions lib/Doctrine/ORM/Query/AST/Functions/SubstringFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Doctrine\ORM\Query\AST\Functions;

use Doctrine\ORM\Query\AST\Node;
use Doctrine\ORM\Query\AST\SimpleArithmeticExpression;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TokenType;
Expand All @@ -19,11 +18,8 @@ class SubstringFunction extends FunctionNode
{
public Node $stringPrimary;

/** @var SimpleArithmeticExpression */
public $firstSimpleArithmeticExpression;

/** @var SimpleArithmeticExpression|null */
public $secondSimpleArithmeticExpression = null;
public Node|string $firstSimpleArithmeticExpression;
public Node|string|null $secondSimpleArithmeticExpression = null;

public function getSql(SqlWalker $sqlWalker): string
{
Expand Down
3 changes: 1 addition & 2 deletions lib/Doctrine/ORM/Query/AST/NullComparisonExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
*/
class NullComparisonExpression extends Node
{
/** @param Node $expression */
public function __construct(
public $expression,
public Node|string $expression,
public bool $not = false,
) {
}
Expand Down
Loading

0 comments on commit 4dd88d6

Please sign in to comment.