Failed Conditions
Pull Request — 2.8.x (#8073)
by
unknown
61:56
created
lib/Doctrine/ORM/Tools/Pagination/RemoveUselessLeftJoinsWalker.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
         $from = $AST->fromClause->identificationVariableDeclarations;
20 20
         $fromRoot = reset($from);
21 21
 
22
-        if (!isset($AST->whereClause) || !isset($AST->whereClause->conditionalExpression) || !isset($AST->whereClause->conditionalExpression->simpleConditionalExpression)) {
22
+        if ( ! isset($AST->whereClause) || ! isset($AST->whereClause->conditionalExpression) || ! isset($AST->whereClause->conditionalExpression->simpleConditionalExpression)) {
23 23
             return;
24 24
         }
25 25
 
26 26
         $expr = $AST->whereClause->conditionalExpression->simpleConditionalExpression;
27 27
 
28
-        if (!isset($expr->subselect)) {
28
+        if ( ! isset($expr->subselect)) {
29 29
             return;
30 30
         }
31 31
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     private function recursiveAddUsages($usages, $parents)
44 44
     {
45 45
         foreach ($usages as $id) {
46
-            if (array_key_exists($id, $parents) && !in_array($parents[$id], $usages)) {
46
+            if (array_key_exists($id, $parents) && ! in_array($parents[$id], $usages)) {
47 47
                 $usages = $this->recursiveAddUsages(array_merge($usages, [$parents[$id]]), $parents);
48 48
             }
49 49
         }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
         $unused = [];
64 64
         foreach ($joins as $join) {
65
-            if (Query\AST\Join::JOIN_TYPE_LEFT === $join->joinType && !in_array($join->joinAssociationDeclaration->aliasIdentificationVariable, $usages)) {
65
+            if (Query\AST\Join::JOIN_TYPE_LEFT === $join->joinType && ! in_array($join->joinAssociationDeclaration->aliasIdentificationVariable, $usages)) {
66 66
                 $unused[] = $join;
67 67
             }
68 68
         }
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 
73 73
     private function filterJoins($joins, $toRemove)
74 74
     {
75
-        return array_filter($joins, function (Query\AST\Join $join) use ($toRemove) {
76
-            return !in_array($join, $toRemove);
75
+        return array_filter($joins, function(Query\AST\Join $join) use ($toRemove) {
76
+            return ! in_array($join, $toRemove);
77 77
         });
78 78
     }
79 79
 
Please login to merge, or discard this patch.
Doctrine/Tests/ORM/Tools/Pagination/RemoveUselessLeftJoinWalkerTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 {
14 14
     public function testUselessLeftJoinsAreRemoved()
15 15
     {
16
-        $dql        = <<<DQL
16
+        $dql = <<<DQL
17 17
 SELECT p, c, a FROM Doctrine\Tests\ORM\Tools\Pagination\MyBlogPost p 
18 18
 LEFT JOIN p.category c 
19 19
 LEFT JOIN p.author a
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
     public function testOrderByLeftJoinsAreKept()
36 36
     {
37
-        $dql        = <<<DQL
37
+        $dql = <<<DQL
38 38
 SELECT p, c, a FROM Doctrine\Tests\ORM\Tools\Pagination\MyBlogPost p 
39 39
 LEFT JOIN p.category c 
40 40
 LEFT JOIN p.author a
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
     public function testWhereLeftJoinsAreKept()
57 57
     {
58
-        $dql        = <<<DQL
58
+        $dql = <<<DQL
59 59
 SELECT p, c, a FROM Doctrine\Tests\ORM\Tools\Pagination\MyBlogPost p 
60 60
 LEFT JOIN p.category c 
61 61
 LEFT JOIN p.author a
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
     public function testMultipleWhereLeftJoinsAreKept()
78 78
     {
79
-        $dql        = <<<DQL
79
+        $dql = <<<DQL
80 80
 SELECT p, c, a FROM Doctrine\Tests\ORM\Tools\Pagination\MyBlogPost p 
81 81
 LEFT JOIN p.category c 
82 82
 LEFT JOIN p.author a
Please login to merge, or discard this patch.