Completed
Pull Request — master (#7978)
by Alexey
06:36
created
lib/Doctrine/ORM/Query/Parser.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
         }
399 399
 
400 400
         foreach ($this->queryComponents as $dqlAlias => $qComp) {
401
-            if (! isset($this->identVariableExpressions[$dqlAlias])) {
401
+            if ( ! isset($this->identVariableExpressions[$dqlAlias])) {
402 402
                 continue;
403 403
             }
404 404
 
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
         $tokenStr = substr($dql, $tokenPos, $length);
464 464
 
465 465
         // Building informative message
466
-        $message = 'line 0, col ' . $tokenPos . " near '" . $tokenStr . "': Error: " . $message;
466
+        $message = 'line 0, col '.$tokenPos." near '".$tokenStr."': Error: ".$message;
467 467
 
468 468
         throw QueryException::semanticalError(
469 469
             $message,
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
             $identVariable = $deferredItem['expression'];
567 567
 
568 568
             // Check if IdentificationVariable exists in queryComponents
569
-            if (! isset($this->queryComponents[$identVariable])) {
569
+            if ( ! isset($this->queryComponents[$identVariable])) {
570 570
                 $this->semanticalError(
571 571
                     sprintf("'%s' is not defined.", $identVariable),
572 572
                     $deferredItem['token']
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
             $qComp = $this->queryComponents[$identVariable];
577 577
 
578 578
             // Check if queryComponent points to an AbstractSchemaName or a ResultVariable
579
-            if (! isset($qComp['metadata'])) {
579
+            if ( ! isset($qComp['metadata'])) {
580 580
                 $this->semanticalError(
581 581
                     sprintf("'%s' does not point to a Class.", $identVariable),
582 582
                     $deferredItem['token']
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
             // If the namespace is not given then assumes the first FROM entity namespace
611 611
             if (strpos($className, '\\') === false && ! class_exists($className) && strpos($fromClassName, '\\') !== false) {
612 612
                 $namespace = substr($fromClassName, 0, strrpos($fromClassName, '\\'));
613
-                $fqcn      = $namespace . '\\' . $className;
613
+                $fqcn      = $namespace.'\\'.$className;
614 614
 
615 615
                 if (class_exists($fqcn)) {
616 616
                     $expression->className = $fqcn;
@@ -618,13 +618,13 @@  discard block
 block discarded – undo
618 618
                 }
619 619
             }
620 620
 
621
-            if (! class_exists($className)) {
621
+            if ( ! class_exists($className)) {
622 622
                 $this->semanticalError(sprintf('Class "%s" is not defined.', $className), $token);
623 623
             }
624 624
 
625 625
             $class = new ReflectionClass($className);
626 626
 
627
-            if (! $class->isInstantiable()) {
627
+            if ( ! $class->isInstantiable()) {
628 628
                 $this->semanticalError(sprintf('Class "%s" can not be instantiated.', $className), $token);
629 629
             }
630 630
 
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
             $resultVariable = $deferredItem['expression'];
682 682
 
683 683
             // Check if ResultVariable exists in queryComponents
684
-            if (! isset($this->queryComponents[$resultVariable])) {
684
+            if ( ! isset($this->queryComponents[$resultVariable])) {
685 685
                 $this->semanticalError(
686 686
                     sprintf("'%s' is not defined.", $resultVariable),
687 687
                     $deferredItem['token']
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
             $qComp = $this->queryComponents[$resultVariable];
692 692
 
693 693
             // Check if queryComponent points to an AbstractSchemaName or a ResultVariable
694
-            if (! isset($qComp['resultVariable'])) {
694
+            if ( ! isset($qComp['resultVariable'])) {
695 695
                 $this->semanticalError(
696 696
                     sprintf("'%s' does not point to a ResultVariable.", $resultVariable),
697 697
                     $deferredItem['token']
@@ -733,9 +733,9 @@  discard block
 block discarded – undo
733 733
             $property = $class->getProperty($field);
734 734
 
735 735
             // Check if field or association exists
736
-            if (! $property) {
736
+            if ( ! $property) {
737 737
                 $this->semanticalError(
738
-                    'Class ' . $class->getClassName() . ' has no field or association named ' . $field,
738
+                    'Class '.$class->getClassName().' has no field or association named '.$field,
739 739
                     $deferredItem['token']
740 740
                 );
741 741
             }
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
             // Validate if PathExpression is one of the expected types
752 752
             $expectedType = $pathExpression->expectedType;
753 753
 
754
-            if (! ($expectedType & $fieldType)) {
754
+            if ( ! ($expectedType & $fieldType)) {
755 755
                 // We need to recognize which was expected type(s)
756 756
                 $expectedStringTypes = [];
757 757
 
@@ -773,8 +773,8 @@  discard block
 block discarded – undo
773 773
                 // Build the error message
774 774
                 $semanticalError  = 'Invalid PathExpression. ';
775 775
                 $semanticalError .= count($expectedStringTypes) === 1
776
-                    ? 'Must be a ' . $expectedStringTypes[0] . '.'
777
-                    : implode(' or ', $expectedStringTypes) . ' expected.';
776
+                    ? 'Must be a '.$expectedStringTypes[0].'.'
777
+                    : implode(' or ', $expectedStringTypes).' expected.';
778 778
 
779 779
                 $this->semanticalError($semanticalError, $deferredItem['token']);
780 780
             }
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 
787 787
     private function processRootEntityAliasSelected()
788 788
     {
789
-        if (! $this->identVariableExpressions) {
789
+        if ( ! $this->identVariableExpressions) {
790 790
             return;
791 791
         }
792 792
 
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
 
944 944
         [$namespaceAlias, $simpleClassName] = explode(':', $this->lexer->token['value']);
945 945
 
946
-        return $this->em->getConfiguration()->getEntityNamespace($namespaceAlias) . '\\' . $simpleClassName;
946
+        return $this->em->getConfiguration()->getEntityNamespace($namespaceAlias).'\\'.$simpleClassName;
947 947
     }
948 948
 
949 949
     /**
@@ -1022,9 +1022,9 @@  discard block
 block discarded – undo
1022 1022
     {
1023 1023
         $identVariable = $this->IdentificationVariable();
1024 1024
 
1025
-        if (! isset($this->queryComponents[$identVariable])) {
1025
+        if ( ! isset($this->queryComponents[$identVariable])) {
1026 1026
             $this->semanticalError(
1027
-                'Identification Variable ' . $identVariable . ' used in join path expression but was not defined before.'
1027
+                'Identification Variable '.$identVariable.' used in join path expression but was not defined before.'
1028 1028
             );
1029 1029
         }
1030 1030
 
@@ -1038,8 +1038,8 @@  discard block
 block discarded – undo
1038 1038
         $class    = $qComp['metadata'];
1039 1039
         $property = $class->getProperty($field);
1040 1040
 
1041
-        if (! ($property !== null && $property instanceof AssociationMetadata)) {
1042
-            $this->semanticalError('Class ' . $class->getClassName() . ' has no association named ' . $field);
1041
+        if ( ! ($property !== null && $property instanceof AssociationMetadata)) {
1042
+            $this->semanticalError('Class '.$class->getClassName().' has no association named '.$field);
1043 1043
         }
1044 1044
 
1045 1045
         return new AST\JoinAssociationPathExpression($identVariable, $field);
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
             while ($this->lexer->isNextToken(Lexer::T_DOT)) {
1070 1070
                 $this->match(Lexer::T_DOT);
1071 1071
                 $this->match(Lexer::T_IDENTIFIER);
1072
-                $field .= '.' . $this->lexer->token['value'];
1072
+                $field .= '.'.$this->lexer->token['value'];
1073 1073
             }
1074 1074
         }
1075 1075
 
@@ -1451,7 +1451,7 @@  discard block
 block discarded – undo
1451 1451
         // Still need to decide between IdentificationVariable or ResultVariable
1452 1452
         $lookaheadValue = $this->lexer->lookahead['value'];
1453 1453
 
1454
-        if (! isset($this->queryComponents[$lookaheadValue])) {
1454
+        if ( ! isset($this->queryComponents[$lookaheadValue])) {
1455 1455
             $this->semanticalError('Cannot group by undefined identification or result variable.');
1456 1456
         }
1457 1457
 
@@ -1799,7 +1799,7 @@  discard block
 block discarded – undo
1799 1799
         while ($this->lexer->isNextToken(Lexer::T_DOT)) {
1800 1800
             $this->match(Lexer::T_DOT);
1801 1801
             $this->match(Lexer::T_IDENTIFIER);
1802
-            $field .= '.' . $this->lexer->token['value'];
1802
+            $field .= '.'.$this->lexer->token['value'];
1803 1803
         }
1804 1804
 
1805 1805
         $partialFieldSet[] = $field;
@@ -1813,7 +1813,7 @@  discard block
 block discarded – undo
1813 1813
             while ($this->lexer->isNextToken(Lexer::T_DOT)) {
1814 1814
                 $this->match(Lexer::T_DOT);
1815 1815
                 $this->match(Lexer::T_IDENTIFIER);
1816
-                $field .= '.' . $this->lexer->token['value'];
1816
+                $field .= '.'.$this->lexer->token['value'];
1817 1817
             }
1818 1818
 
1819 1819
             $partialFieldSet[] = $field;
@@ -2419,7 +2419,7 @@  discard block
 block discarded – undo
2419 2419
 
2420 2420
         // Phase 1 AST optimization: Prevent AST\ConditionalFactor
2421 2421
         // if only one AST\ConditionalPrimary is defined
2422
-        if (! $not) {
2422
+        if ( ! $not) {
2423 2423
             return $conditionalPrimary;
2424 2424
         }
2425 2425
 
@@ -2438,7 +2438,7 @@  discard block
 block discarded – undo
2438 2438
     {
2439 2439
         $condPrimary = new AST\ConditionalPrimary();
2440 2440
 
2441
-        if (! $this->lexer->isNextToken(Lexer::T_OPEN_PARENTHESIS)) {
2441
+        if ( ! $this->lexer->isNextToken(Lexer::T_OPEN_PARENTHESIS)) {
2442 2442
             $condPrimary->simpleConditionalExpression = $this->SimpleConditionalExpression();
2443 2443
 
2444 2444
             return $condPrimary;
@@ -2607,7 +2607,7 @@  discard block
 block discarded – undo
2607 2607
             $this->match(Lexer::T_OF);
2608 2608
         }
2609 2609
 
2610
-        $collMemberExpr      = new AST\CollectionMemberExpression(
2610
+        $collMemberExpr = new AST\CollectionMemberExpression(
2611 2611
             $entityExpr,
2612 2612
             $this->CollectionValuedPathExpression()
2613 2613
         );
@@ -2941,7 +2941,7 @@  discard block
 block discarded – undo
2941 2941
         $lookaheadType = $this->lexer->lookahead['type'];
2942 2942
         $isDistinct    = false;
2943 2943
 
2944
-        if (! in_array($lookaheadType, [Lexer::T_COUNT, Lexer::T_AVG, Lexer::T_MAX, Lexer::T_MIN, Lexer::T_SUM], true)) {
2944
+        if ( ! in_array($lookaheadType, [Lexer::T_COUNT, Lexer::T_AVG, Lexer::T_MAX, Lexer::T_MIN, Lexer::T_SUM], true)) {
2945 2945
             $this->syntaxError('One of: MAX, MIN, AVG, SUM, COUNT');
2946 2946
         }
2947 2947
 
@@ -2971,7 +2971,7 @@  discard block
 block discarded – undo
2971 2971
         $lookaheadType = $this->lexer->lookahead['type'];
2972 2972
         $value         = $this->lexer->lookahead['value'];
2973 2973
 
2974
-        if (! in_array($lookaheadType, [Lexer::T_ALL, Lexer::T_ANY, Lexer::T_SOME], true)) {
2974
+        if ( ! in_array($lookaheadType, [Lexer::T_ALL, Lexer::T_ANY, Lexer::T_SOME], true)) {
2975 2975
             $this->syntaxError('ALL, ANY or SOME');
2976 2976
         }
2977 2977
 
@@ -3209,7 +3209,7 @@  discard block
 block discarded – undo
3209 3209
                 $lookaheadValue = $this->lexer->lookahead['value'];
3210 3210
 
3211 3211
                 // Validate existing component
3212
-                if (! isset($this->queryComponents[$lookaheadValue])) {
3212
+                if ( ! isset($this->queryComponents[$lookaheadValue])) {
3213 3213
                     $this->semanticalError('Cannot add having condition on undefined result variable.');
3214 3214
                 }
3215 3215
 
@@ -3220,7 +3220,7 @@  discard block
 block discarded – undo
3220 3220
                 }
3221 3221
 
3222 3222
                 // Validating ResultVariable
3223
-                if (! isset($this->queryComponents[$lookaheadValue]['resultVariable'])) {
3223
+                if ( ! isset($this->queryComponents[$lookaheadValue]['resultVariable'])) {
3224 3224
                     $this->semanticalError('Cannot add having condition on a non result variable.');
3225 3225
                 }
3226 3226
 
Please login to merge, or discard this patch.