Migrate AST namespace to PHP 8 syntax
Use typed properties when type is non-object
We know the phpdoc types in that namespace are pretty messed up, but it should be safe to assume that's only the case when the type is an object type.
15 | 15 | */ |
|
16 | 16 | class QuantifiedExpression extends Node |
|
17 | 17 | { |
|
18 | - | /** @var string */ |
|
19 | - | public $type; |
|
18 | + | public string $type; |
|
20 | 19 | ||
21 | 20 | /** @param Subselect $subselect */ |
|
22 | 21 | public function __construct(public $subselect) |
|
23 | 22 | { |
|
24 | 23 | } |
|
25 | 24 | ||
26 | - | /** @return bool */ |
|
27 | - | public function isAll() |
|
25 | + | public function isAll(): bool |
|
28 | 26 | { |
|
29 | 27 | return strtoupper($this->type) === 'ALL'; |
|
30 | 28 | } |
|
31 | 29 | ||
32 | - | /** @return bool */ |
|
33 | - | public function isAny() |
|
30 | + | public function isAny(): bool |
|
34 | 31 | { |
|
35 | 32 | return strtoupper($this->type) === 'ANY'; |
|
36 | 33 | } |
|
37 | 34 | ||
38 | - | /** @return bool */ |
|
39 | - | public function isSome() |
|
35 | + | public function isSome(): bool |
|
40 | 36 | { |
|
41 | 37 | return strtoupper($this->type) === 'SOME'; |
|
42 | 38 | } |
13 | 13 | */ |
|
14 | 14 | class IndexBy extends Node |
|
15 | 15 | { |
|
16 | - | /** @var PathExpression */ |
|
17 | - | public $singleValuedPathExpression = null; |
|
18 | - | ||
19 | - | public function __construct(PathExpression $singleValuedPathExpression) |
|
16 | + | public function __construct(public PathExpression $singleValuedPathExpression) |
|
20 | 17 | { |
|
21 | - | $this->singleValuedPathExpression = $singleValuedPathExpression; |
|
22 | 18 | } |
|
23 | 19 | ||
24 | 20 | public function dispatch(SqlWalker $walker): string |
8 | 8 | ||
9 | 9 | class BetweenExpression extends Node |
|
10 | 10 | { |
|
11 | - | /** @var ArithmeticExpression */ |
|
12 | - | public $expression; |
|
13 | - | ||
14 | - | /** @var ArithmeticExpression */ |
|
15 | - | public $leftBetweenExpression; |
|
16 | - | ||
17 | - | /** @var ArithmeticExpression */ |
|
18 | - | public $rightBetweenExpression; |
|
19 | - | ||
20 | - | /** @var bool */ |
|
21 | - | public $not; |
|
22 | - | ||
23 | 11 | /** |
|
24 | - | * @param ArithmeticExpression $expr |
|
25 | - | * @param ArithmeticExpression $leftExpr |
|
26 | - | * @param ArithmeticExpression $rightExpr |
|
12 | + | * @param ArithmeticExpression $expression |
|
13 | + | * @param ArithmeticExpression $leftBetweenExpression |
|
14 | + | * @param ArithmeticExpression $rightBetweenExpression |
|
27 | 15 | */ |
|
28 | - | public function __construct($expr, $leftExpr, $rightExpr, bool $not = false) |
|
29 | - | { |
|
30 | - | $this->expression = $expr; |
|
31 | - | $this->leftBetweenExpression = $leftExpr; |
|
32 | - | $this->rightBetweenExpression = $rightExpr; |
|
33 | - | $this->not = $not; |
|
16 | + | public function __construct( |
|
17 | + | public $expression, |
|
18 | + | public $leftBetweenExpression, |
|
19 | + | public $rightBetweenExpression, |
|
20 | + | public bool $not = false, |
|
21 | + | ) { |
|
34 | 22 | } |
|
35 | 23 | ||
36 | 24 | public function dispatch(SqlWalker $walker): string |
13 | 13 | */ |
|
14 | 14 | class CoalesceExpression extends Node |
|
15 | 15 | { |
|
16 | - | /** @var mixed[] */ |
|
17 | - | public $scalarExpressions = []; |
|
18 | - | ||
19 | 16 | /** @param mixed[] $scalarExpressions */ |
|
20 | - | public function __construct(array $scalarExpressions) |
|
17 | + | public function __construct(public array $scalarExpressions) |
|
21 | 18 | { |
|
22 | - | $this->scalarExpressions = $scalarExpressions; |
|
23 | 19 | } |
|
24 | 20 | ||
25 | 21 | public function dispatch(SqlWalker $walker): string |
17 | 17 | */ |
|
18 | 18 | class InstanceOfExpression extends Node |
|
19 | 19 | { |
|
20 | - | /** @var string */ |
|
21 | - | public $identificationVariable; |
|
22 | - | ||
23 | 20 | /** |
|
24 | - | * @param string $identVariable |
|
21 | + | * @param string $identificationVariable |
|
25 | 22 | * @param non-empty-list<InputParameter|string> $value |
|
26 | 23 | */ |
|
27 | 24 | public function __construct( |
|
28 | - | $identVariable, |
|
25 | + | public $identificationVariable, |
|
29 | 26 | public array $value = [], |
|
30 | 27 | public bool $not = false, |
|
31 | 28 | ) { |
37 | 34 | __METHOD__, |
|
38 | 35 | ); |
|
39 | 36 | } |
|
40 | - | ||
41 | - | $this->identificationVariable = $identVariable; |
|
42 | 37 | } |
|
43 | 38 | ||
44 | 39 | public function dispatch(SqlWalker $walker): string |
13 | 13 | ||
14 | 14 | class InputParameter extends Node |
|
15 | 15 | { |
|
16 | - | /** @var bool */ |
|
17 | - | public $isNamed; |
|
18 | - | ||
19 | - | /** @var string */ |
|
20 | - | public $name; |
|
21 | - | ||
22 | - | /** |
|
23 | - | * @param string $value |
|
24 | - | * |
|
25 | - | * @throws QueryException |
|
26 | - | */ |
|
27 | - | public function __construct($value) |
|
16 | + | public bool $isNamed; |
|
17 | + | public string $name; |
|
18 | + | ||
19 | + | /** @throws QueryException */ |
|
20 | + | public function __construct(string $value) |
|
28 | 21 | { |
|
29 | 22 | if (strlen($value) === 1) { |
|
30 | 23 | throw QueryException::invalidParameterFormat($value); |
14 | 14 | */ |
|
15 | 15 | class SimpleSelectExpression extends Node |
|
16 | 16 | { |
|
17 | - | /** @var string */ |
|
18 | - | public $fieldIdentificationVariable; |
|
17 | + | public string|null $fieldIdentificationVariable = null; |
|
19 | 18 | ||
20 | 19 | /** @param Node|string $expression */ |
|
21 | 20 | public function __construct(public $expression) |
13 | 13 | */ |
|
14 | 14 | class GeneralCaseExpression extends Node |
|
15 | 15 | { |
|
16 | - | /** @var mixed[] */ |
|
17 | - | public $whenClauses = []; |
|
18 | - | ||
19 | - | /** |
|
20 | - | * @param mixed[] $whenClauses |
|
21 | - | * @param mixed $elseScalarExpression |
|
22 | - | */ |
|
23 | - | public function __construct(array $whenClauses, public $elseScalarExpression = null) |
|
24 | - | { |
|
25 | - | $this->whenClauses = $whenClauses; |
|
16 | + | /** @param mixed[] $whenClauses */ |
|
17 | + | public function __construct( |
|
18 | + | public array $whenClauses, |
|
19 | + | public mixed $elseScalarExpression = null, |
|
20 | + | ) { |
|
26 | 21 | } |
|
27 | 22 | ||
28 | 23 | public function dispatch(SqlWalker $walker): string |
17 | 17 | */ |
|
18 | 18 | class PathExpression extends Node |
|
19 | 19 | { |
|
20 | - | public const TYPE_COLLECTION_VALUED_ASSOCIATION = 2; |
|
21 | - | public const TYPE_SINGLE_VALUED_ASSOCIATION = 4; |
|
22 | - | public const TYPE_STATE_FIELD = 8; |
|
23 | - | ||
24 | - | /** |
|
25 | - | * @var int|null |
|
26 | - | * @psalm-var self::TYPE_*|null |
|
27 | - | */ |
|
28 | - | public $type; |
|
29 | - | ||
30 | - | /** |
|
31 | - | * @var int |
|
32 | - | * @psalm-var int-mask-of<self::TYPE_*> |
|
33 | - | */ |
|
34 | - | public $expectedType; |
|
35 | - | ||
36 | - | /** |
|
37 | - | * @param int $expectedType |
|
38 | - | * @param string $identificationVariable |
|
39 | - | * @param string|null $field |
|
40 | - | * @psalm-param int-mask-of<self::TYPE_*> $expectedType |
|
41 | - | */ |
|
42 | - | public function __construct($expectedType, public $identificationVariable, public $field = null) |
|
43 | - | { |
|
44 | - | $this->expectedType = $expectedType; |
|
20 | + | final public const TYPE_COLLECTION_VALUED_ASSOCIATION = 2; |
|
21 | + | final public const TYPE_SINGLE_VALUED_ASSOCIATION = 4; |
|
22 | + | final public const TYPE_STATE_FIELD = 8; |
|
23 | + | ||
24 | + | /** @psalm-var self::TYPE_*|null */ |
|
25 | + | public int|null $type; |
|
26 | + | ||
27 | + | /** @psalm-param int-mask-of<self::TYPE_*> $expectedType */ |
|
28 | + | public function __construct( |
|
29 | + | public int $expectedType, |
|
30 | + | public string $identificationVariable, |
|
31 | + | public string|null $field = null, |
|
32 | + | ) { |
|
45 | 33 | } |
|
46 | 34 | ||
47 | 35 | public function dispatch(SqlWalker $walker): string |
8 | 8 | ||
9 | 9 | class GroupByClause extends Node |
|
10 | 10 | { |
|
11 | - | /** @var mixed[] */ |
|
12 | - | public $groupByItems = []; |
|
13 | - | ||
14 | 11 | /** @param mixed[] $groupByItems */ |
|
15 | - | public function __construct(array $groupByItems) |
|
12 | + | public function __construct(public array $groupByItems) |
|
16 | 13 | { |
|
17 | - | $this->groupByItems = $groupByItems; |
|
18 | 14 | } |
|
19 | 15 | ||
20 | 16 | public function dispatch(SqlWalker $walker): string |
14 | 14 | */ |
|
15 | 15 | class Join extends Node |
|
16 | 16 | { |
|
17 | - | public const JOIN_TYPE_LEFT = 1; |
|
18 | - | public const JOIN_TYPE_LEFTOUTER = 2; |
|
19 | - | public const JOIN_TYPE_INNER = 3; |
|
20 | - | ||
21 | - | /** |
|
22 | - | * @var int |
|
23 | - | * @psalm-var self::JOIN_TYPE_* |
|
24 | - | */ |
|
25 | - | public $joinType = self::JOIN_TYPE_INNER; |
|
17 | + | final public const JOIN_TYPE_LEFT = 1; |
|
18 | + | final public const JOIN_TYPE_LEFTOUTER = 2; |
|
19 | + | final public const JOIN_TYPE_INNER = 3; |
|
26 | 20 | ||
27 | 21 | /** @var ConditionalExpression|null */ |
|
28 | 22 | public $conditionalExpression = null; |
|
29 | 23 | ||
30 | 24 | /** |
|
31 | - | * @param int $joinType |
|
32 | 25 | * @param Node $joinAssociationDeclaration |
|
33 | 26 | * @psalm-param self::JOIN_TYPE_* $joinType |
|
34 | 27 | */ |
|
35 | - | public function __construct($joinType, public $joinAssociationDeclaration = null) |
|
36 | - | { |
|
37 | - | $this->joinType = $joinType; |
|
28 | + | public function __construct( |
|
29 | + | public int $joinType, |
|
30 | + | public $joinAssociationDeclaration = null, |
|
31 | + | ) { |
|
38 | 32 | } |
|
39 | 33 | ||
40 | 34 | public function dispatch(SqlWalker $walker): string |
6 | 6 | ||
7 | 7 | class InListExpression extends InExpression |
|
8 | 8 | { |
|
9 | - | /** @var non-empty-list<mixed> */ |
|
10 | - | public $literals; |
|
11 | - | ||
12 | 9 | /** @param non-empty-list<mixed> $literals */ |
|
13 | - | public function __construct(ArithmeticExpression $expression, array $literals, bool $not = false) |
|
10 | + | public function __construct(ArithmeticExpression $expression, public array $literals, bool $not = false) |
|
14 | 11 | { |
|
15 | - | $this->literals = $literals; |
|
16 | - | $this->not = $not; |
|
12 | + | $this->not = $not; |
|
17 | 13 | ||
18 | 14 | parent::__construct($expression); |
|
19 | 15 | } |
13 | 13 | */ |
|
14 | 14 | class SimpleWhenClause extends Node |
|
15 | 15 | { |
|
16 | - | /** |
|
17 | - | * @param mixed $caseScalarExpression |
|
18 | - | * @param mixed $thenScalarExpression |
|
19 | - | */ |
|
20 | - | public function __construct(public $caseScalarExpression = null, public $thenScalarExpression = null) |
|
21 | - | { |
|
16 | + | public function __construct( |
|
17 | + | public mixed $caseScalarExpression = null, |
|
18 | + | public mixed $thenScalarExpression = null, |
|
19 | + | ) { |
|
22 | 20 | } |
|
23 | 21 | ||
24 | 22 | public function dispatch(SqlWalker $walker): string |
13 | 13 | */ |
|
14 | 14 | class JoinClassPathExpression extends Node |
|
15 | 15 | { |
|
16 | - | /** @var mixed */ |
|
17 | - | public $aliasIdentificationVariable; |
|
18 | - | ||
19 | - | /** |
|
20 | - | * @param mixed $abstractSchemaName |
|
21 | - | * @param mixed $aliasIdentificationVar |
|
22 | - | */ |
|
23 | - | public function __construct(public $abstractSchemaName, $aliasIdentificationVar) |
|
24 | - | { |
|
25 | - | $this->aliasIdentificationVariable = $aliasIdentificationVar; |
|
16 | + | public function __construct( |
|
17 | + | public mixed $abstractSchemaName, |
|
18 | + | public mixed $aliasIdentificationVariable, |
|
19 | + | ) { |
|
26 | 20 | } |
|
27 | 21 | ||
28 | 22 | public function dispatch(SqlWalker $walker): string |
13 | 13 | */ |
|
14 | 14 | class SimpleArithmeticExpression extends Node |
|
15 | 15 | { |
|
16 | - | /** @var mixed[] */ |
|
17 | - | public $arithmeticTerms = []; |
|
18 | - | ||
19 | 16 | /** @param mixed[] $arithmeticTerms */ |
|
20 | - | public function __construct(array $arithmeticTerms) |
|
17 | + | public function __construct(public array $arithmeticTerms) |
|
21 | 18 | { |
|
22 | - | $this->arithmeticTerms = $arithmeticTerms; |
|
23 | 19 | } |
|
24 | 20 | ||
25 | 21 | public function dispatch(SqlWalker $walker): string |
13 | 13 | */ |
|
14 | 14 | class SimpleSelectClause extends Node |
|
15 | 15 | { |
|
16 | - | /** |
|
17 | - | * @param SimpleSelectExpression $simpleSelectExpression |
|
18 | - | * @param bool $isDistinct |
|
19 | - | */ |
|
20 | - | public function __construct(public $simpleSelectExpression, public $isDistinct = false) |
|
21 | - | { |
|
16 | + | /** @param SimpleSelectExpression $simpleSelectExpression */ |
|
17 | + | public function __construct( |
|
18 | + | public $simpleSelectExpression, |
|
19 | + | public bool $isDistinct = false, |
|
20 | + | ) { |
|
22 | 21 | } |
|
23 | 22 | ||
24 | 23 | public function dispatch(SqlWalker $walker): string |
13 | 13 | */ |
|
14 | 14 | class ArithmeticTerm extends Node |
|
15 | 15 | { |
|
16 | - | /** @var mixed[] */ |
|
17 | - | public $arithmeticFactors; |
|
18 | - | ||
19 | 16 | /** @param mixed[] $arithmeticFactors */ |
|
20 | - | public function __construct(array $arithmeticFactors) |
|
17 | + | public function __construct(public array $arithmeticFactors) |
|
21 | 18 | { |
|
22 | - | $this->arithmeticFactors = $arithmeticFactors; |
|
23 | 19 | } |
|
24 | 20 | ||
25 | 21 | public function dispatch(SqlWalker $walker): string |
11 | 11 | */ |
|
12 | 12 | class SubselectIdentificationVariableDeclaration |
|
13 | 13 | { |
|
14 | - | /** |
|
15 | - | * @param PathExpression $associationPathExpression |
|
16 | - | * @param string $aliasIdentificationVariable |
|
17 | - | */ |
|
18 | - | public function __construct(public $associationPathExpression, public $aliasIdentificationVariable) |
|
19 | - | { |
|
14 | + | /** @param PathExpression $associationPathExpression */ |
|
15 | + | public function __construct( |
|
16 | + | public $associationPathExpression, |
|
17 | + | public string $aliasIdentificationVariable, |
|
18 | + | ) { |
|
20 | 19 | } |
|
21 | 20 | } |
13 | 13 | */ |
|
14 | 14 | class FromClause extends Node |
|
15 | 15 | { |
|
16 | - | /** @var mixed[] */ |
|
17 | - | public $identificationVariableDeclarations = []; |
|
18 | - | ||
19 | 16 | /** @param mixed[] $identificationVariableDeclarations */ |
|
20 | - | public function __construct(array $identificationVariableDeclarations) |
|
17 | + | public function __construct(public array $identificationVariableDeclarations) |
|
21 | 18 | { |
|
22 | - | $this->identificationVariableDeclarations = $identificationVariableDeclarations; |
|
23 | 19 | } |
|
24 | 20 | ||
25 | 21 | public function dispatch(SqlWalker $walker): string |
5 | 5 | namespace Doctrine\ORM\Query\AST; |
|
6 | 6 | ||
7 | 7 | use Doctrine\ORM\Query\SqlWalker; |
|
8 | + | use Stringable; |
|
8 | 9 | ||
9 | 10 | use function get_debug_type; |
|
10 | 11 | use function get_object_vars; |
20 | 21 | * |
|
21 | 22 | * @link www.doctrine-project.org |
|
22 | 23 | */ |
|
23 | - | abstract class Node |
|
24 | + | abstract class Node implements Stringable |
|
24 | 25 | { |
|
25 | 26 | /** |
|
26 | 27 | * Double-dispatch method, supposed to dispatch back to the walker. |
36 | 37 | ||
37 | 38 | /** |
|
38 | 39 | * Dumps the AST Node into a string representation for information purpose only. |
|
39 | - | * |
|
40 | - | * @return string |
|
41 | 40 | */ |
|
42 | - | public function __toString() |
|
41 | + | public function __toString(): string |
|
43 | 42 | { |
|
44 | 43 | return $this->dump($this); |
|
45 | 44 | } |
|
46 | 45 | ||
47 | - | /** |
|
48 | - | * @param mixed $value |
|
49 | - | * |
|
50 | - | * @return string |
|
51 | - | */ |
|
52 | - | public function dump($value) |
|
46 | + | public function dump(mixed $value): string |
|
53 | 47 | { |
|
54 | 48 | static $ident = 0; |
|
55 | 49 |
19 | 19 | /** @var Subselect|null */ |
|
20 | 20 | public $subselect; |
|
21 | 21 | ||
22 | - | /** @return bool */ |
|
23 | - | public function isSimpleArithmeticExpression() |
|
22 | + | public function isSimpleArithmeticExpression(): bool |
|
24 | 23 | { |
|
25 | 24 | return (bool) $this->simpleArithmeticExpression; |
|
26 | 25 | } |
|
27 | 26 | ||
28 | - | /** @return bool */ |
|
29 | - | public function isSubselect() |
|
27 | + | public function isSubselect(): bool |
|
30 | 28 | { |
|
31 | 29 | return (bool) $this->subselect; |
|
32 | 30 | } |
18 | 18 | */ |
|
19 | 19 | class ComparisonExpression extends Node |
|
20 | 20 | { |
|
21 | - | /** @var Node|string */ |
|
22 | - | public $leftExpression; |
|
23 | - | ||
24 | - | /** @var Node|string */ |
|
25 | - | public $rightExpression; |
|
26 | - | ||
27 | 21 | /** |
|
28 | - | * @param Node|string $leftExpr |
|
29 | - | * @param string $operator |
|
30 | - | * @param Node|string $rightExpr |
|
22 | + | * @param Node|string $leftExpression |
|
23 | + | * @param Node|string $rightExpression |
|
31 | 24 | */ |
|
32 | - | public function __construct($leftExpr, public $operator, $rightExpr) |
|
33 | - | { |
|
34 | - | $this->leftExpression = $leftExpr; |
|
35 | - | $this->rightExpression = $rightExpr; |
|
25 | + | public function __construct( |
|
26 | + | public $leftExpression, |
|
27 | + | public string $operator, |
|
28 | + | public $rightExpression, |
|
29 | + | ) { |
|
36 | 30 | } |
|
37 | 31 | ||
38 | 32 | public function dispatch(SqlWalker $walker): string |
13 | 13 | */ |
|
14 | 14 | class UpdateClause extends Node |
|
15 | 15 | { |
|
16 | - | /** @var string */ |
|
17 | - | public $aliasIdentificationVariable; |
|
16 | + | public string $aliasIdentificationVariable; |
|
18 | 17 | ||
19 | - | /** @var mixed[] */ |
|
20 | - | public $updateItems = []; |
|
21 | - | ||
22 | - | /** |
|
23 | - | * @param string $abstractSchemaName |
|
24 | - | * @param mixed[] $updateItems |
|
25 | - | */ |
|
26 | - | public function __construct(public $abstractSchemaName, array $updateItems) |
|
27 | - | { |
|
28 | - | $this->updateItems = $updateItems; |
|
18 | + | /** @param mixed[] $updateItems */ |
|
19 | + | public function __construct( |
|
20 | + | public string $abstractSchemaName, |
|
21 | + | public array $updateItems, |
|
22 | + | ) { |
|
29 | 23 | } |
|
30 | 24 | ||
31 | 25 | public function dispatch(SqlWalker $walker): string |
15 | 15 | { |
|
16 | 16 | /** |
|
17 | 17 | * @param JoinAssociationPathExpression $joinAssociationPathExpression |
|
18 | - | * @param string $aliasIdentificationVariable |
|
19 | 18 | * @param IndexBy|null $indexBy |
|
20 | 19 | */ |
|
21 | - | public function __construct(public $joinAssociationPathExpression, public $aliasIdentificationVariable, public $indexBy) |
|
22 | - | { |
|
20 | + | public function __construct( |
|
21 | + | public $joinAssociationPathExpression, |
|
22 | + | public string $aliasIdentificationVariable, |
|
23 | + | public $indexBy, |
|
24 | + | ) { |
|
23 | 25 | } |
|
24 | 26 | ||
25 | 27 | public function dispatch(SqlWalker $walker): string |
13 | 13 | */ |
|
14 | 14 | class ConditionalTerm extends Node |
|
15 | 15 | { |
|
16 | - | /** @var mixed[] */ |
|
17 | - | public $conditionalFactors = []; |
|
18 | - | ||
19 | 16 | /** @param mixed[] $conditionalFactors */ |
|
20 | - | public function __construct(array $conditionalFactors) |
|
17 | + | public function __construct(public array $conditionalFactors) |
|
21 | 18 | { |
|
22 | - | $this->conditionalFactors = $conditionalFactors; |
|
23 | 19 | } |
|
24 | 20 | ||
25 | 21 | public function dispatch(SqlWalker $walker): string |
13 | 13 | */ |
|
14 | 14 | class SelectClause extends Node |
|
15 | 15 | { |
|
16 | - | /** @var mixed[] */ |
|
17 | - | public $selectExpressions = []; |
|
18 | - | ||
19 | - | /** |
|
20 | - | * @param mixed[] $selectExpressions |
|
21 | - | * @param bool $isDistinct |
|
22 | - | */ |
|
23 | - | public function __construct(array $selectExpressions, public $isDistinct) |
|
24 | - | { |
|
25 | - | $this->selectExpressions = $selectExpressions; |
|
16 | + | /** @param mixed[] $selectExpressions */ |
|
17 | + | public function __construct( |
|
18 | + | public array $selectExpressions, |
|
19 | + | public bool $isDistinct, |
|
20 | + | ) { |
|
26 | 21 | } |
|
27 | 22 | ||
28 | 23 | public function dispatch(SqlWalker $walker): string |
6 | 6 | ||
7 | 7 | class PartialObjectExpression extends Node |
|
8 | 8 | { |
|
9 | - | /** @var mixed[] */ |
|
10 | - | public $partialFieldSet; |
|
11 | - | ||
12 | - | /** |
|
13 | - | * @param string $identificationVariable |
|
14 | - | * @param mixed[] $partialFieldSet |
|
15 | - | */ |
|
16 | - | public function __construct(public $identificationVariable, array $partialFieldSet) |
|
17 | - | { |
|
18 | - | $this->partialFieldSet = $partialFieldSet; |
|
9 | + | /** @param mixed[] $partialFieldSet */ |
|
10 | + | public function __construct( |
|
11 | + | public string $identificationVariable, |
|
12 | + | public array $partialFieldSet, |
|
13 | + | ) { |
|
19 | 14 | } |
|
20 | 15 | } |
14 | 14 | */ |
|
15 | 15 | class SelectExpression extends Node |
|
16 | 16 | { |
|
17 | - | /** |
|
18 | - | * @param mixed $expression |
|
19 | - | * @param string|null $fieldIdentificationVariable |
|
20 | - | * @param bool $hiddenAliasResultVariable |
|
21 | - | */ |
|
22 | - | public function __construct(public $expression, public $fieldIdentificationVariable, public $hiddenAliasResultVariable = false) |
|
23 | - | { |
|
17 | + | public function __construct( |
|
18 | + | public mixed $expression, |
|
19 | + | public string|null $fieldIdentificationVariable, |
|
20 | + | public bool $hiddenAliasResultVariable = false, |
|
21 | + | ) { |
|
24 | 22 | } |
|
25 | 23 | ||
26 | 24 | public function dispatch(SqlWalker $walker): string |
13 | 13 | */ |
|
14 | 14 | class NullIfExpression extends Node |
|
15 | 15 | { |
|
16 | - | /** |
|
17 | - | * @param mixed $firstExpression |
|
18 | - | * @param mixed $secondExpression |
|
19 | - | */ |
|
20 | - | public function __construct(public $firstExpression, public $secondExpression) |
|
16 | + | public function __construct(public mixed $firstExpression, public mixed $secondExpression) |
|
21 | 17 | { |
|
22 | 18 | } |
|
23 | 19 |
13 | 13 | */ |
|
14 | 14 | class OrderByClause extends Node |
|
15 | 15 | { |
|
16 | - | /** @var OrderByItem[] */ |
|
17 | - | public $orderByItems = []; |
|
18 | - | ||
19 | 16 | /** @param OrderByItem[] $orderByItems */ |
|
20 | - | public function __construct(array $orderByItems) |
|
17 | + | public function __construct(public array $orderByItems) |
|
21 | 18 | { |
|
22 | - | $this->orderByItems = $orderByItems; |
|
23 | 19 | } |
|
24 | 20 | ||
25 | 21 | public function dispatch(SqlWalker $walker): string |
11 | 11 | */ |
|
12 | 12 | class JoinAssociationPathExpression extends Node |
|
13 | 13 | { |
|
14 | - | /** |
|
15 | - | * @param string $identificationVariable |
|
16 | - | * @param string $associationField |
|
17 | - | */ |
|
18 | - | public function __construct(public $identificationVariable, public $associationField) |
|
19 | - | { |
|
14 | + | public function __construct( |
|
15 | + | public string $identificationVariable, |
|
16 | + | public string $associationField, |
|
17 | + | ) { |
|
20 | 18 | } |
|
21 | 19 | } |
19 | 19 | /** @var ConditionalExpression|null */ |
|
20 | 20 | public $conditionalExpression; |
|
21 | 21 | ||
22 | - | /** @return bool */ |
|
23 | - | public function isSimpleConditionalExpression() |
|
22 | + | public function isSimpleConditionalExpression(): bool |
|
24 | 23 | { |
|
25 | 24 | return (bool) $this->simpleConditionalExpression; |
|
26 | 25 | } |
|
27 | 26 | ||
28 | - | /** @return bool */ |
|
29 | - | public function isConditionalExpression() |
|
27 | + | public function isConditionalExpression(): bool |
|
30 | 28 | { |
|
31 | 29 | return (bool) $this->conditionalExpression; |
|
32 | 30 | } |
13 | 13 | */ |
|
14 | 14 | class WhenClause extends Node |
|
15 | 15 | { |
|
16 | - | /** |
|
17 | - | * @param ConditionalExpression $caseConditionExpression |
|
18 | - | * @param mixed $thenScalarExpression |
|
19 | - | */ |
|
20 | - | public function __construct(public $caseConditionExpression, public $thenScalarExpression = null) |
|
21 | - | { |
|
16 | + | /** @param ConditionalExpression $caseConditionExpression */ |
|
17 | + | public function __construct( |
|
18 | + | public $caseConditionExpression, |
|
19 | + | public mixed $thenScalarExpression = null, |
|
20 | + | ) { |
|
22 | 21 | } |
|
23 | 22 | ||
24 | 23 | public function dispatch(SqlWalker $walker): string |
13 | 13 | */ |
|
14 | 14 | class NewObjectExpression extends Node |
|
15 | 15 | { |
|
16 | - | /** @var mixed[] */ |
|
17 | - | public $args; |
|
18 | - | ||
19 | - | /** |
|
20 | - | * @param string $className |
|
21 | - | * @param mixed[] $args |
|
22 | - | */ |
|
23 | - | public function __construct(public $className, array $args) |
|
16 | + | /** @param mixed[] $args */ |
|
17 | + | public function __construct(public string $className, public array $args) |
|
24 | 18 | { |
|
25 | - | $this->args = $args; |
|
26 | 19 | } |
|
27 | 20 | ||
28 | 21 | public function dispatch(SqlWalker $walker): string |
13 | 13 | */ |
|
14 | 14 | class DeleteClause extends Node |
|
15 | 15 | { |
|
16 | - | /** @var string */ |
|
17 | - | public $aliasIdentificationVariable; |
|
16 | + | public string $aliasIdentificationVariable; |
|
18 | 17 | ||
19 | - | /** @param string $abstractSchemaName */ |
|
20 | - | public function __construct(public $abstractSchemaName) |
|
18 | + | public function __construct(public string $abstractSchemaName) |
|
21 | 19 | { |
|
22 | 20 | } |
|
23 | 21 |
9 | 9 | class AggregateExpression extends Node |
|
10 | 10 | { |
|
11 | 11 | /** |
|
12 | - | * Some aggregate expressions support distinct, eg COUNT. |
|
13 | - | * |
|
14 | - | * @var bool |
|
15 | - | */ |
|
16 | - | public $isDistinct = false; |
|
17 | - | ||
18 | - | /** |
|
19 | - | * @param string $functionName |
|
20 | 12 | * @param PathExpression|SimpleArithmeticExpression $pathExpression |
|
21 | - | * @param bool $isDistinct |
|
13 | + | * @param bool $isDistinct Some aggregate expressions support distinct, eg COUNT. |
|
22 | 14 | */ |
|
23 | - | public function __construct(public $functionName, public $pathExpression, $isDistinct) |
|
24 | - | { |
|
25 | - | $this->isDistinct = $isDistinct; |
|
15 | + | public function __construct( |
|
16 | + | public string $functionName, |
|
17 | + | public $pathExpression, |
|
18 | + | public bool $isDistinct, |
|
19 | + | ) { |
|
26 | 20 | } |
|
27 | 21 | ||
28 | 22 | public function dispatch(SqlWalker $walker): string |
16 | 16 | /** |
|
17 | 17 | * @param PathExpression $caseOperand |
|
18 | 18 | * @param mixed[] $simpleWhenClauses |
|
19 | - | * @param mixed $elseScalarExpression |
|
20 | 19 | */ |
|
21 | 20 | public function __construct( |
|
22 | 21 | public $caseOperand = null, |
|
23 | 22 | public array $simpleWhenClauses = [], |
|
24 | - | public $elseScalarExpression = null, |
|
23 | + | public mixed $elseScalarExpression = null, |
|
25 | 24 | ) { |
|
26 | 25 | } |
|
27 | 26 |
13 | 13 | */ |
|
14 | 14 | class ASTException extends QueryException |
|
15 | 15 | { |
|
16 | - | /** |
|
17 | - | * @param Node $node |
|
18 | - | * |
|
19 | - | * @return ASTException |
|
20 | - | */ |
|
21 | - | public static function noDispatchForNode($node) |
|
16 | + | public static function noDispatchForNode(Node $node): self |
|
22 | 17 | { |
|
23 | 18 | return new self('Double-dispatch for node ' . get_debug_type($node) . ' is not supported.'); |
|
24 | 19 | } |
13 | 13 | */ |
|
14 | 14 | class CollectionMemberExpression extends Node |
|
15 | 15 | { |
|
16 | - | /** @var mixed */ |
|
17 | - | public $entityExpression; |
|
18 | - | ||
19 | - | /** @var PathExpression */ |
|
20 | - | public $collectionValuedPathExpression; |
|
21 | - | ||
22 | - | /** @var bool */ |
|
23 | - | public $not; |
|
24 | - | ||
25 | - | /** |
|
26 | - | * @param mixed $entityExpr |
|
27 | - | * @param PathExpression $collValuedPathExpr |
|
28 | - | */ |
|
29 | - | public function __construct($entityExpr, $collValuedPathExpr, bool $not = false) |
|
30 | - | { |
|
31 | - | $this->entityExpression = $entityExpr; |
|
32 | - | $this->collectionValuedPathExpression = $collValuedPathExpr; |
|
33 | - | $this->not = $not; |
|
16 | + | /** @param PathExpression $collectionValuedPathExpression */ |
|
17 | + | public function __construct( |
|
18 | + | public mixed $entityExpression, |
|
19 | + | public $collectionValuedPathExpression, |
|
20 | + | public bool $not = false, |
|
21 | + | ) { |
|
34 | 22 | } |
|
35 | 23 | ||
36 | 24 | public function dispatch(SqlWalker $walker): string |
8 | 8 | ||
9 | 9 | class Literal extends Node |
|
10 | 10 | { |
|
11 | - | public const STRING = 1; |
|
12 | - | public const BOOLEAN = 2; |
|
13 | - | public const NUMERIC = 3; |
|
11 | + | final public const STRING = 1; |
|
12 | + | final public const BOOLEAN = 2; |
|
13 | + | final public const NUMERIC = 3; |
|
14 | 14 | ||
15 | - | /** |
|
16 | - | * @var int |
|
17 | - | * @psalm-var self::* |
|
18 | - | */ |
|
19 | - | public $type; |
|
20 | - | ||
21 | - | /** |
|
22 | - | * @param int $type |
|
23 | - | * @param mixed $value |
|
24 | - | * @psalm-param self::* $type |
|
25 | - | */ |
|
26 | - | public function __construct($type, public $value) |
|
27 | - | { |
|
28 | - | $this->type = $type; |
|
15 | + | /** @psalm-param self::* $type */ |
|
16 | + | public function __construct( |
|
17 | + | public int $type, |
|
18 | + | public mixed $value, |
|
19 | + | ) { |
|
29 | 20 | } |
|
30 | 21 | ||
31 | 22 | public function dispatch(SqlWalker $walker): string |
13 | 13 | */ |
|
14 | 14 | class RangeVariableDeclaration extends Node |
|
15 | 15 | { |
|
16 | - | /** @var string */ |
|
17 | - | public $aliasIdentificationVariable; |
|
18 | - | ||
19 | - | /** |
|
20 | - | * @param string $abstractSchemaName |
|
21 | - | * @param string $aliasIdentificationVar |
|
22 | - | * @param bool $isRoot |
|
23 | - | */ |
|
24 | - | public function __construct(public $abstractSchemaName, $aliasIdentificationVar, public $isRoot = true) |
|
25 | - | { |
|
26 | - | $this->aliasIdentificationVariable = $aliasIdentificationVar; |
|
16 | + | public function __construct( |
|
17 | + | public string $abstractSchemaName, |
|
18 | + | public string $aliasIdentificationVariable, |
|
19 | + | public bool $isRoot = true, |
|
20 | + | ) { |
|
27 | 21 | } |
|
28 | 22 | ||
29 | 23 | public function dispatch(SqlWalker $walker): string |
15 | 15 | */ |
|
16 | 16 | class OrderByItem extends Node |
|
17 | 17 | { |
|
18 | - | /** @var string */ |
|
19 | - | public $type; |
|
18 | + | public string $type; |
|
20 | 19 | ||
21 | - | /** @param mixed $expression */ |
|
22 | - | public function __construct(public $expression) |
|
20 | + | public function __construct(public mixed $expression) |
|
23 | 21 | { |
|
24 | 22 | } |
|
25 | 23 | ||
26 | - | /** @return bool */ |
|
27 | - | public function isAsc() |
|
24 | + | public function isAsc(): bool |
|
28 | 25 | { |
|
29 | 26 | return strtoupper($this->type) === 'ASC'; |
|
30 | 27 | } |
|
31 | 28 | ||
32 | - | /** @return bool */ |
|
33 | - | public function isDesc() |
|
29 | + | public function isDesc(): bool |
|
34 | 30 | { |
|
35 | 31 | return strtoupper($this->type) === 'DESC'; |
|
36 | 32 | } |
13 | 13 | */ |
|
14 | 14 | class ArithmeticFactor extends Node |
|
15 | 15 | { |
|
16 | - | /** |
|
17 | - | * NULL represents no sign, TRUE means positive and FALSE means negative sign. |
|
18 | - | * |
|
19 | - | * @var bool|null |
|
20 | - | */ |
|
21 | - | public $sign; |
|
22 | - | ||
23 | - | /** |
|
24 | - | * @param mixed $arithmeticPrimary |
|
25 | - | * @param bool|null $sign |
|
26 | - | */ |
|
27 | - | public function __construct(public $arithmeticPrimary, $sign = null) |
|
28 | - | { |
|
29 | - | $this->sign = $sign; |
|
16 | + | public function __construct( |
|
17 | + | public mixed $arithmeticPrimary, |
|
18 | + | public bool|null $sign = null, |
|
19 | + | ) { |
|
30 | 20 | } |
|
31 | 21 | ||
32 | - | /** @return bool */ |
|
33 | - | public function isPositiveSigned() |
|
22 | + | public function isPositiveSigned(): bool |
|
34 | 23 | { |
|
35 | 24 | return $this->sign === true; |
|
36 | 25 | } |
|
37 | 26 | ||
38 | - | /** @return bool */ |
|
39 | - | public function isNegativeSigned() |
|
27 | + | public function isNegativeSigned(): bool |
|
40 | 28 | { |
|
41 | 29 | return $this->sign === false; |
|
42 | 30 | } |
13 | 13 | */ |
|
14 | 14 | class ConditionalExpression extends Node |
|
15 | 15 | { |
|
16 | - | /** @var mixed[] */ |
|
17 | - | public $conditionalTerms = []; |
|
18 | - | ||
19 | 16 | /** @param mixed[] $conditionalTerms */ |
|
20 | - | public function __construct(array $conditionalTerms) |
|
17 | + | public function __construct(public array $conditionalTerms) |
|
21 | 18 | { |
|
22 | - | $this->conditionalTerms = $conditionalTerms; |
|
23 | 19 | } |
|
24 | 20 | ||
25 | 21 | public function dispatch(SqlWalker $walker): string |
13 | 13 | */ |
|
14 | 14 | class SubselectFromClause extends Node |
|
15 | 15 | { |
|
16 | - | /** @var mixed[] */ |
|
17 | - | public $identificationVariableDeclarations = []; |
|
18 | - | ||
19 | 16 | /** @param mixed[] $identificationVariableDeclarations */ |
|
20 | - | public function __construct(array $identificationVariableDeclarations) |
|
17 | + | public function __construct(public array $identificationVariableDeclarations) |
|
21 | 18 | { |
|
22 | - | $this->identificationVariableDeclarations = $identificationVariableDeclarations; |
|
23 | 19 | } |
|
24 | 20 | ||
25 | 21 | public function dispatch(SqlWalker $walker): string |
11 | 11 | */ |
|
12 | 12 | class ParenthesisExpression extends Node |
|
13 | 13 | { |
|
14 | - | /** @var Node */ |
|
15 | - | public $expression; |
|
16 | - | ||
17 | - | public function __construct(Node $expression) |
|
14 | + | public function __construct(public Node $expression) |
|
18 | 15 | { |
|
19 | - | $this->expression = $expression; |
|
20 | 16 | } |
|
21 | 17 | ||
22 | 18 | public function dispatch(SqlWalker $walker): string |
68 | 68 | * |
|
69 | 69 | * @throws ASTException |
|
70 | 70 | */ |
|
71 | - | private function dispatchIntervalExpression(SqlWalker $sqlWalker) |
|
71 | + | private function dispatchIntervalExpression(SqlWalker $sqlWalker): string |
|
72 | 72 | { |
|
73 | 73 | $sql = $this->intervalExpression->dispatch($sqlWalker); |
|
74 | 74 | assert(is_numeric($sql)); |
14 | 14 | */ |
|
15 | 15 | class InExpression extends Node |
|
16 | 16 | { |
|
17 | - | /** @var bool */ |
|
18 | - | public $not; |
|
17 | + | public bool $not = false; |
|
19 | 18 | ||
20 | 19 | /** @var mixed[] */ |
|
21 | - | public $literals = []; |
|
20 | + | public array $literals = []; |
|
22 | 21 | ||
23 | 22 | /** @var Subselect|null */ |
|
24 | 23 | public $subselect; |
Files | Coverage |
---|---|
lib/Doctrine/ORM | 89.60% |
Project Totals (332 files) | 89.60% |