@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Doctrine\ORM\Query; |
| 6 | 6 | |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | foreach ($this->queryComponents as $dqlAlias => $qComp) { |
| 409 | - if (! isset($this->identVariableExpressions[$dqlAlias])) { |
|
| 409 | + if ( ! isset($this->identVariableExpressions[$dqlAlias])) { |
|
| 410 | 410 | continue; |
| 411 | 411 | } |
| 412 | 412 | |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | $tokenStr = substr($dql, (int) $token['position'], $length); |
| 471 | 471 | |
| 472 | 472 | // Building informative message |
| 473 | - $message = 'line 0, col ' . $tokenPos . " near '" . $tokenStr . "': Error: " . $message; |
|
| 473 | + $message = 'line 0, col '.$tokenPos." near '".$tokenStr."': Error: ".$message; |
|
| 474 | 474 | |
| 475 | 475 | throw QueryException::semanticalError( |
| 476 | 476 | $message, |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | $identVariable = $deferredItem['expression']; |
| 574 | 574 | |
| 575 | 575 | // Check if IdentificationVariable exists in queryComponents |
| 576 | - if (! isset($this->queryComponents[$identVariable])) { |
|
| 576 | + if ( ! isset($this->queryComponents[$identVariable])) { |
|
| 577 | 577 | $this->semanticalError( |
| 578 | 578 | sprintf("'%s' is not defined.", $identVariable), |
| 579 | 579 | $deferredItem['token'] |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | $qComp = $this->queryComponents[$identVariable]; |
| 584 | 584 | |
| 585 | 585 | // Check if queryComponent points to an AbstractSchemaName or a ResultVariable |
| 586 | - if (! isset($qComp['metadata'])) { |
|
| 586 | + if ( ! isset($qComp['metadata'])) { |
|
| 587 | 587 | $this->semanticalError( |
| 588 | 588 | sprintf("'%s' does not point to a Class.", $identVariable), |
| 589 | 589 | $deferredItem['token'] |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | // If the namespace is not given then assumes the first FROM entity namespace |
| 618 | 618 | if (strpos($className, '\\') === false && ! class_exists($className) && strpos($fromClassName, '\\') !== false) { |
| 619 | 619 | $namespace = substr($fromClassName, 0, strrpos($fromClassName, '\\')); |
| 620 | - $fqcn = $namespace . '\\' . $className; |
|
| 620 | + $fqcn = $namespace.'\\'.$className; |
|
| 621 | 621 | |
| 622 | 622 | if (class_exists($fqcn)) { |
| 623 | 623 | $expression->className = $fqcn; |
@@ -625,13 +625,13 @@ discard block |
||
| 625 | 625 | } |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | - if (! class_exists($className)) { |
|
| 628 | + if ( ! class_exists($className)) { |
|
| 629 | 629 | $this->semanticalError(sprintf('Class "%s" is not defined.', $className), $token); |
| 630 | 630 | } |
| 631 | 631 | |
| 632 | 632 | $class = new \ReflectionClass($className); |
| 633 | 633 | |
| 634 | - if (! $class->isInstantiable()) { |
|
| 634 | + if ( ! $class->isInstantiable()) { |
|
| 635 | 635 | $this->semanticalError(sprintf('Class "%s" can not be instantiated.', $className), $token); |
| 636 | 636 | } |
| 637 | 637 | |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | $resultVariable = $deferredItem['expression']; |
| 689 | 689 | |
| 690 | 690 | // Check if ResultVariable exists in queryComponents |
| 691 | - if (! isset($this->queryComponents[$resultVariable])) { |
|
| 691 | + if ( ! isset($this->queryComponents[$resultVariable])) { |
|
| 692 | 692 | $this->semanticalError( |
| 693 | 693 | sprintf("'%s' is not defined.", $resultVariable), |
| 694 | 694 | $deferredItem['token'] |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | $qComp = $this->queryComponents[$resultVariable]; |
| 699 | 699 | |
| 700 | 700 | // Check if queryComponent points to an AbstractSchemaName or a ResultVariable |
| 701 | - if (! isset($qComp['resultVariable'])) { |
|
| 701 | + if ( ! isset($qComp['resultVariable'])) { |
|
| 702 | 702 | $this->semanticalError( |
| 703 | 703 | sprintf("'%s' does not point to a ResultVariable.", $resultVariable), |
| 704 | 704 | $deferredItem['token'] |
@@ -740,9 +740,9 @@ discard block |
||
| 740 | 740 | $property = $class->getProperty($field); |
| 741 | 741 | |
| 742 | 742 | // Check if field or association exists |
| 743 | - if (! $property) { |
|
| 743 | + if ( ! $property) { |
|
| 744 | 744 | $this->semanticalError( |
| 745 | - 'Class ' . $class->getClassName() . ' has no field or association named ' . $field, |
|
| 745 | + 'Class '.$class->getClassName().' has no field or association named '.$field, |
|
| 746 | 746 | $deferredItem['token'] |
| 747 | 747 | ); |
| 748 | 748 | } |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | // Validate if PathExpression is one of the expected types |
| 760 | 760 | $expectedType = $pathExpression->expectedType; |
| 761 | 761 | |
| 762 | - if (! ($expectedType & $fieldType)) { |
|
| 762 | + if ( ! ($expectedType & $fieldType)) { |
|
| 763 | 763 | // We need to recognize which was expected type(s) |
| 764 | 764 | $expectedStringTypes = []; |
| 765 | 765 | |
@@ -781,8 +781,8 @@ discard block |
||
| 781 | 781 | // Build the error message |
| 782 | 782 | $semanticalError = 'Invalid PathExpression. '; |
| 783 | 783 | $semanticalError .= count($expectedStringTypes) === 1 |
| 784 | - ? 'Must be a ' . $expectedStringTypes[0] . '.' |
|
| 785 | - : implode(' or ', $expectedStringTypes) . ' expected.'; |
|
| 784 | + ? 'Must be a '.$expectedStringTypes[0].'.' |
|
| 785 | + : implode(' or ', $expectedStringTypes).' expected.'; |
|
| 786 | 786 | |
| 787 | 787 | $this->semanticalError($semanticalError, $deferredItem['token']); |
| 788 | 788 | } |
@@ -794,7 +794,7 @@ discard block |
||
| 794 | 794 | |
| 795 | 795 | private function processRootEntityAliasSelected() |
| 796 | 796 | { |
| 797 | - if (! $this->identVariableExpressions) { |
|
| 797 | + if ( ! $this->identVariableExpressions) { |
|
| 798 | 798 | return; |
| 799 | 799 | } |
| 800 | 800 | |
@@ -951,7 +951,7 @@ discard block |
||
| 951 | 951 | |
| 952 | 952 | [$namespaceAlias, $simpleClassName] = explode(':', $this->lexer->token['value']); |
| 953 | 953 | |
| 954 | - return $this->em->getConfiguration()->getEntityNamespace($namespaceAlias) . '\\' . $simpleClassName; |
|
| 954 | + return $this->em->getConfiguration()->getEntityNamespace($namespaceAlias).'\\'.$simpleClassName; |
|
| 955 | 955 | } |
| 956 | 956 | |
| 957 | 957 | /** |
@@ -1030,9 +1030,9 @@ discard block |
||
| 1030 | 1030 | { |
| 1031 | 1031 | $identVariable = $this->IdentificationVariable(); |
| 1032 | 1032 | |
| 1033 | - if (! isset($this->queryComponents[$identVariable])) { |
|
| 1033 | + if ( ! isset($this->queryComponents[$identVariable])) { |
|
| 1034 | 1034 | $this->semanticalError( |
| 1035 | - 'Identification Variable ' . $identVariable . ' used in join path expression but was not defined before.' |
|
| 1035 | + 'Identification Variable '.$identVariable.' used in join path expression but was not defined before.' |
|
| 1036 | 1036 | ); |
| 1037 | 1037 | } |
| 1038 | 1038 | |
@@ -1046,8 +1046,8 @@ discard block |
||
| 1046 | 1046 | $class = $qComp['metadata']; |
| 1047 | 1047 | $property = $class->getProperty($field); |
| 1048 | 1048 | |
| 1049 | - if (! ($property !== null && $property instanceof AssociationMetadata)) { |
|
| 1050 | - $this->semanticalError('Class ' . $class->getClassName() . ' has no association named ' . $field); |
|
| 1049 | + if ( ! ($property !== null && $property instanceof AssociationMetadata)) { |
|
| 1050 | + $this->semanticalError('Class '.$class->getClassName().' has no association named '.$field); |
|
| 1051 | 1051 | } |
| 1052 | 1052 | |
| 1053 | 1053 | return new AST\JoinAssociationPathExpression($identVariable, $field); |
@@ -1077,7 +1077,7 @@ discard block |
||
| 1077 | 1077 | while ($this->lexer->isNextToken(Lexer::T_DOT)) { |
| 1078 | 1078 | $this->match(Lexer::T_DOT); |
| 1079 | 1079 | $this->match(Lexer::T_IDENTIFIER); |
| 1080 | - $field .= '.' . $this->lexer->token['value']; |
|
| 1080 | + $field .= '.'.$this->lexer->token['value']; |
|
| 1081 | 1081 | } |
| 1082 | 1082 | } |
| 1083 | 1083 | |
@@ -1461,7 +1461,7 @@ discard block |
||
| 1461 | 1461 | // Still need to decide between IdentificationVariable or ResultVariable |
| 1462 | 1462 | $lookaheadValue = $this->lexer->lookahead['value']; |
| 1463 | 1463 | |
| 1464 | - if (! isset($this->queryComponents[$lookaheadValue])) { |
|
| 1464 | + if ( ! isset($this->queryComponents[$lookaheadValue])) { |
|
| 1465 | 1465 | $this->semanticalError('Cannot group by undefined identification or result variable.'); |
| 1466 | 1466 | } |
| 1467 | 1467 | |
@@ -1809,7 +1809,7 @@ discard block |
||
| 1809 | 1809 | while ($this->lexer->isNextToken(Lexer::T_DOT)) { |
| 1810 | 1810 | $this->match(Lexer::T_DOT); |
| 1811 | 1811 | $this->match(Lexer::T_IDENTIFIER); |
| 1812 | - $field .= '.' . $this->lexer->token['value']; |
|
| 1812 | + $field .= '.'.$this->lexer->token['value']; |
|
| 1813 | 1813 | } |
| 1814 | 1814 | |
| 1815 | 1815 | $partialFieldSet[] = $field; |
@@ -1823,7 +1823,7 @@ discard block |
||
| 1823 | 1823 | while ($this->lexer->isNextToken(Lexer::T_DOT)) { |
| 1824 | 1824 | $this->match(Lexer::T_DOT); |
| 1825 | 1825 | $this->match(Lexer::T_IDENTIFIER); |
| 1826 | - $field .= '.' . $this->lexer->token['value']; |
|
| 1826 | + $field .= '.'.$this->lexer->token['value']; |
|
| 1827 | 1827 | } |
| 1828 | 1828 | |
| 1829 | 1829 | $partialFieldSet[] = $field; |
@@ -2444,7 +2444,7 @@ discard block |
||
| 2444 | 2444 | |
| 2445 | 2445 | // Phase 1 AST optimization: Prevent AST\ConditionalFactor |
| 2446 | 2446 | // if only one AST\ConditionalPrimary is defined |
| 2447 | - if (! $not) { |
|
| 2447 | + if ( ! $not) { |
|
| 2448 | 2448 | return $conditionalPrimary; |
| 2449 | 2449 | } |
| 2450 | 2450 | |
@@ -2463,7 +2463,7 @@ discard block |
||
| 2463 | 2463 | { |
| 2464 | 2464 | $condPrimary = new AST\ConditionalPrimary(); |
| 2465 | 2465 | |
| 2466 | - if (! $this->lexer->isNextToken(Lexer::T_OPEN_PARENTHESIS)) { |
|
| 2466 | + if ( ! $this->lexer->isNextToken(Lexer::T_OPEN_PARENTHESIS)) { |
|
| 2467 | 2467 | $condPrimary->simpleConditionalExpression = $this->SimpleConditionalExpression(); |
| 2468 | 2468 | |
| 2469 | 2469 | return $condPrimary; |
@@ -2631,7 +2631,7 @@ discard block |
||
| 2631 | 2631 | $this->match(Lexer::T_OF); |
| 2632 | 2632 | } |
| 2633 | 2633 | |
| 2634 | - $collMemberExpr = new AST\CollectionMemberExpression( |
|
| 2634 | + $collMemberExpr = new AST\CollectionMemberExpression( |
|
| 2635 | 2635 | $entityExpr, |
| 2636 | 2636 | $this->CollectionValuedPathExpression() |
| 2637 | 2637 | ); |
@@ -2966,7 +2966,7 @@ discard block |
||
| 2966 | 2966 | $lookaheadType = $this->lexer->lookahead['type']; |
| 2967 | 2967 | $isDistinct = false; |
| 2968 | 2968 | |
| 2969 | - if (! in_array($lookaheadType, [Lexer::T_COUNT, Lexer::T_AVG, Lexer::T_MAX, Lexer::T_MIN, Lexer::T_SUM], true)) { |
|
| 2969 | + if ( ! in_array($lookaheadType, [Lexer::T_COUNT, Lexer::T_AVG, Lexer::T_MAX, Lexer::T_MIN, Lexer::T_SUM], true)) { |
|
| 2970 | 2970 | $this->syntaxError('One of: MAX, MIN, AVG, SUM, COUNT'); |
| 2971 | 2971 | } |
| 2972 | 2972 | |
@@ -2996,7 +2996,7 @@ discard block |
||
| 2996 | 2996 | $lookaheadType = $this->lexer->lookahead['type']; |
| 2997 | 2997 | $value = $this->lexer->lookahead['value']; |
| 2998 | 2998 | |
| 2999 | - if (! in_array($lookaheadType, [Lexer::T_ALL, Lexer::T_ANY, Lexer::T_SOME], true)) { |
|
| 2999 | + if ( ! in_array($lookaheadType, [Lexer::T_ALL, Lexer::T_ANY, Lexer::T_SOME], true)) { |
|
| 3000 | 3000 | $this->syntaxError('ALL, ANY or SOME'); |
| 3001 | 3001 | } |
| 3002 | 3002 | |
@@ -3234,7 +3234,7 @@ discard block |
||
| 3234 | 3234 | $lookaheadValue = $this->lexer->lookahead['value']; |
| 3235 | 3235 | |
| 3236 | 3236 | // Validate existing component |
| 3237 | - if (! isset($this->queryComponents[$lookaheadValue])) { |
|
| 3237 | + if ( ! isset($this->queryComponents[$lookaheadValue])) { |
|
| 3238 | 3238 | $this->semanticalError('Cannot add having condition on undefined result variable.'); |
| 3239 | 3239 | } |
| 3240 | 3240 | |
@@ -3245,7 +3245,7 @@ discard block |
||
| 3245 | 3245 | } |
| 3246 | 3246 | |
| 3247 | 3247 | // Validating ResultVariable |
| 3248 | - if (! isset($this->queryComponents[$lookaheadValue]['resultVariable'])) { |
|
| 3248 | + if ( ! isset($this->queryComponents[$lookaheadValue]['resultVariable'])) { |
|
| 3249 | 3249 | $this->semanticalError('Cannot add having condition on a non result variable.'); |
| 3250 | 3250 | } |
| 3251 | 3251 | |