@@ -49,7 +49,7 @@  | 
                                                    ||
| 49 | 49 | /**  | 
                                                        
| 50 | 50 | * Gets the SQL query.  | 
                                                        
| 51 | 51 | *  | 
                                                        
| 52 | - * @return mixed The built SQL query or an array of all SQL queries.  | 
                                                        |
| 52 | + * @return string The built SQL query or an array of all SQL queries.  | 
                                                        |
| 53 | 53 | *  | 
                                                        
| 54 | 54 | * @override  | 
                                                        
| 55 | 55 | */  | 
                                                        
@@ -1,6 +1,6 @@  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | |
| 3 | -declare(strict_types=1);  | 
                                                        |
| 3 | +declare(strict_types = 1);  | 
                                                        |
| 4 | 4 | |
| 5 | 5 | namespace Doctrine\ORM;  | 
                                                        
| 6 | 6 | |
@@ -20,7 +20,6 @@  | 
                                                    ||
| 20 | 20 | namespace Doctrine\ORM\Query;  | 
                                                        
| 21 | 21 | |
| 22 | 22 | use Doctrine\Common\Collections\ArrayCollection;  | 
                                                        
| 23 | -  | 
                                                        |
| 24 | 23 | use Doctrine\Common\Collections\Expr\ExpressionVisitor;  | 
                                                        
| 25 | 24 | use Doctrine\Common\Collections\Expr\Comparison;  | 
                                                        
| 26 | 25 | use Doctrine\Common\Collections\Expr\CompositeExpression;  | 
                                                        
@@ -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 | |
@@ -99,7 +99,7 @@ discard block  | 
                                                    ||
| 99 | 99 | $expressionList[] = $this->dispatch($child);  | 
                                                        
| 100 | 100 | }  | 
                                                        
| 101 | 101 | |
| 102 | -        switch($expr->getType()) { | 
                                                        |
| 102 | +        switch ($expr->getType()) { | 
                                                        |
| 103 | 103 | case CompositeExpression::TYPE_AND:  | 
                                                        
| 104 | 104 | return new Expr\Andx($expressionList);  | 
                                                        
| 105 | 105 | |
@@ -107,7 +107,7 @@ discard block  | 
                                                    ||
| 107 | 107 | return new Expr\Orx($expressionList);  | 
                                                        
| 108 | 108 | |
| 109 | 109 | default:  | 
                                                        
| 110 | -                throw new \RuntimeException("Unknown composite " . $expr->getType()); | 
                                                        |
| 110 | +                throw new \RuntimeException("Unknown composite ".$expr->getType()); | 
                                                        |
| 111 | 111 | }  | 
                                                        
| 112 | 112 | }  | 
                                                        
| 113 | 113 | |
@@ -121,10 +121,10 @@ discard block  | 
                                                    ||
| 121 | 121 |              throw new QueryException('No aliases are set before invoking walkComparison().'); | 
                                                        
| 122 | 122 | }  | 
                                                        
| 123 | 123 | |
| 124 | - $field = $this->queryAliases[0] . '.' . $comparison->getField();  | 
                                                        |
| 124 | + $field = $this->queryAliases[0].'.'.$comparison->getField();  | 
                                                        |
| 125 | 125 | |
| 126 | -        foreach($this->queryAliases as $alias) { | 
                                                        |
| 127 | -            if(strpos($comparison->getField() . '.', $alias . '.') === 0) { | 
                                                        |
| 126 | +        foreach ($this->queryAliases as $alias) { | 
                                                        |
| 127 | +            if (strpos($comparison->getField().'.', $alias.'.') === 0) { | 
                                                        |
| 128 | 128 | $field = $comparison->getField();  | 
                                                        
| 129 | 129 | break;  | 
                                                        
| 130 | 130 | }  | 
                                                        
@@ -135,13 +135,13 @@ discard block  | 
                                                    ||
| 135 | 135 | |
| 136 | 136 |          foreach ($this->parameters as $parameter) { | 
                                                        
| 137 | 137 |              if ($parameter->getName() === $parameterName) { | 
                                                        
| 138 | - $parameterName .= '_' . $parameterCount;  | 
                                                        |
| 138 | + $parameterName .= '_'.$parameterCount;  | 
                                                        |
| 139 | 139 | break;  | 
                                                        
| 140 | 140 | }  | 
                                                        
| 141 | 141 | }  | 
                                                        
| 142 | 142 | |
| 143 | 143 | $parameter = new Parameter($parameterName, $this->walkValue($comparison->getValue()));  | 
                                                        
| 144 | - $placeholder = ':' . $parameterName;  | 
                                                        |
| 144 | + $placeholder = ':'.$parameterName;  | 
                                                        |
| 145 | 145 | |
| 146 | 146 |          switch ($comparison->getOperator()) { | 
                                                        
| 147 | 147 | case Comparison::IN:  | 
                                                        
@@ -168,17 +168,17 @@ discard block  | 
                                                    ||
| 168 | 168 | |
| 169 | 169 | return $this->expr->neq($field, $placeholder);  | 
                                                        
| 170 | 170 | case Comparison::CONTAINS:  | 
                                                        
| 171 | -                $parameter->setValue('%' . $parameter->getValue() . '%', $parameter->getType()); | 
                                                        |
| 171 | +                $parameter->setValue('%'.$parameter->getValue().'%', $parameter->getType()); | 
                                                        |
| 172 | 172 | $this->parameters[] = $parameter;  | 
                                                        
| 173 | 173 | |
| 174 | 174 | return $this->expr->like($field, $placeholder);  | 
                                                        
| 175 | 175 | case Comparison::STARTS_WITH:  | 
                                                        
| 176 | - $parameter->setValue($parameter->getValue() . '%', $parameter->getType());  | 
                                                        |
| 176 | + $parameter->setValue($parameter->getValue().'%', $parameter->getType());  | 
                                                        |
| 177 | 177 | $this->parameters[] = $parameter;  | 
                                                        
| 178 | 178 | |
| 179 | 179 | return $this->expr->like($field, $placeholder);  | 
                                                        
| 180 | 180 | case Comparison::ENDS_WITH:  | 
                                                        
| 181 | -                $parameter->setValue('%' . $parameter->getValue(), $parameter->getType()); | 
                                                        |
| 181 | +                $parameter->setValue('%'.$parameter->getValue(), $parameter->getType()); | 
                                                        |
| 182 | 182 | $this->parameters[] = $parameter;  | 
                                                        
| 183 | 183 | |
| 184 | 184 | return $this->expr->like($field, $placeholder);  | 
                                                        
@@ -194,7 +194,7 @@ discard block  | 
                                                    ||
| 194 | 194 | );  | 
                                                        
| 195 | 195 | }  | 
                                                        
| 196 | 196 | |
| 197 | -                throw new \RuntimeException("Unknown comparison operator: " . $comparison->getOperator()); | 
                                                        |
| 197 | +                throw new \RuntimeException("Unknown comparison operator: ".$comparison->getOperator()); | 
                                                        |
| 198 | 198 | }  | 
                                                        
| 199 | 199 | }  | 
                                                        
| 200 | 200 | |
@@ -21,7 +21,6 @@  | 
                                                    ||
| 21 | 21 | |
| 22 | 22 | use Doctrine\Common\Collections\ArrayCollection;  | 
                                                        
| 23 | 23 | use Doctrine\Common\Collections\Criteria;  | 
                                                        
| 24 | -  | 
                                                        |
| 25 | 24 | use Doctrine\ORM\Query\Expr;  | 
                                                        
| 26 | 25 | use Doctrine\ORM\Query\QueryExpressionVisitor;  | 
                                                        
| 27 | 26 | |
@@ -120,11 +120,11 @@ discard block  | 
                                                    ||
| 120 | 120 | */  | 
                                                        
| 121 | 121 | private $joinRootAliases = [];  | 
                                                        
| 122 | 122 | |
| 123 | - /**  | 
                                                        |
| 124 | - * Whether to use second level cache, if available.  | 
                                                        |
| 125 | - *  | 
                                                        |
| 126 | - * @var boolean  | 
                                                        |
| 127 | - */  | 
                                                        |
| 123 | + /**  | 
                                                        |
| 124 | + * Whether to use second level cache, if available.  | 
                                                        |
| 125 | + *  | 
                                                        |
| 126 | + * @var boolean  | 
                                                        |
| 127 | + */  | 
                                                        |
| 128 | 128 | protected $cacheable = false;  | 
                                                        
| 129 | 129 | |
| 130 | 130 | /**  | 
                                                        
@@ -215,10 +215,10 @@ discard block  | 
                                                    ||
| 215 | 215 | }  | 
                                                        
| 216 | 216 | |
| 217 | 217 | /**  | 
                                                        
| 218 | - * Obtain the name of the second level query cache region in which query results will be stored  | 
                                                        |
| 219 | - *  | 
                                                        |
| 220 | - * @return string|null The cache region name; NULL indicates the default region.  | 
                                                        |
| 221 | - */  | 
                                                        |
| 218 | + * Obtain the name of the second level query cache region in which query results will be stored  | 
                                                        |
| 219 | + *  | 
                                                        |
| 220 | + * @return string|null The cache region name; NULL indicates the default region.  | 
                                                        |
| 221 | + */  | 
                                                        |
| 222 | 222 | public function getCacheRegion()  | 
                                                        
| 223 | 223 |      { | 
                                                        
| 224 | 224 | return $this->cacheRegion;  | 
                                                        
@@ -1375,10 +1375,10 @@ discard block  | 
                                                    ||
| 1375 | 1375 | */  | 
                                                        
| 1376 | 1376 | private function getDQLForDelete()  | 
                                                        
| 1377 | 1377 |      { | 
                                                        
| 1378 | - return 'DELETE'  | 
                                                        |
| 1379 | -              . $this->getReducedDQLQueryPart('from', ['pre' => ' ', 'separator' => ', ']) | 
                                                        |
| 1380 | -              . $this->getReducedDQLQueryPart('where', ['pre' => ' WHERE ']) | 
                                                        |
| 1381 | -              . $this->getReducedDQLQueryPart('orderBy', ['pre' => ' ORDER BY ', 'separator' => ', ']); | 
                                                        |
| 1378 | + return 'DELETE'  | 
                                                        |
| 1379 | +                . $this->getReducedDQLQueryPart('from', ['pre' => ' ', 'separator' => ', ']) | 
                                                        |
| 1380 | +                . $this->getReducedDQLQueryPart('where', ['pre' => ' WHERE ']) | 
                                                        |
| 1381 | +                . $this->getReducedDQLQueryPart('orderBy', ['pre' => ' ORDER BY ', 'separator' => ', ']); | 
                                                        |
| 1382 | 1382 | }  | 
                                                        
| 1383 | 1383 | |
| 1384 | 1384 | /**  | 
                                                        
@@ -1386,11 +1386,11 @@ discard block  | 
                                                    ||
| 1386 | 1386 | */  | 
                                                        
| 1387 | 1387 | private function getDQLForUpdate()  | 
                                                        
| 1388 | 1388 |      { | 
                                                        
| 1389 | - return 'UPDATE'  | 
                                                        |
| 1390 | -              . $this->getReducedDQLQueryPart('from', ['pre' => ' ', 'separator' => ', ']) | 
                                                        |
| 1391 | -              . $this->getReducedDQLQueryPart('set', ['pre' => ' SET ', 'separator' => ', ']) | 
                                                        |
| 1392 | -              . $this->getReducedDQLQueryPart('where', ['pre' => ' WHERE ']) | 
                                                        |
| 1393 | -              . $this->getReducedDQLQueryPart('orderBy', ['pre' => ' ORDER BY ', 'separator' => ', ']); | 
                                                        |
| 1389 | + return 'UPDATE'  | 
                                                        |
| 1390 | +                . $this->getReducedDQLQueryPart('from', ['pre' => ' ', 'separator' => ', ']) | 
                                                        |
| 1391 | +                . $this->getReducedDQLQueryPart('set', ['pre' => ' SET ', 'separator' => ', ']) | 
                                                        |
| 1392 | +                . $this->getReducedDQLQueryPart('where', ['pre' => ' WHERE ']) | 
                                                        |
| 1393 | +                . $this->getReducedDQLQueryPart('orderBy', ['pre' => ' ORDER BY ', 'separator' => ', ']); | 
                                                        |
| 1394 | 1394 | }  | 
                                                        
| 1395 | 1395 | |
| 1396 | 1396 | /**  | 
                                                        
@@ -1399,8 +1399,8 @@ discard block  | 
                                                    ||
| 1399 | 1399 | private function getDQLForSelect()  | 
                                                        
| 1400 | 1400 |      { | 
                                                        
| 1401 | 1401 | $dql = 'SELECT'  | 
                                                        
| 1402 | - . ($this->dqlParts['distinct']===true ? ' DISTINCT' : '')  | 
                                                        |
| 1403 | -             . $this->getReducedDQLQueryPart('select', ['pre' => ' ', 'separator' => ', ']); | 
                                                        |
| 1402 | + . ($this->dqlParts['distinct']===true ? ' DISTINCT' : '')  | 
                                                        |
| 1403 | +                . $this->getReducedDQLQueryPart('select', ['pre' => ' ', 'separator' => ', ']); | 
                                                        |
| 1404 | 1404 | |
| 1405 | 1405 |          $fromParts   = $this->getDQLPart('from'); | 
                                                        
| 1406 | 1406 |          $joinParts   = $this->getDQLPart('join'); | 
                                                        
@@ -1424,10 +1424,10 @@ discard block  | 
                                                    ||
| 1424 | 1424 | }  | 
                                                        
| 1425 | 1425 | |
| 1426 | 1426 |          $dql .= implode(', ', $fromClauses) | 
                                                        
| 1427 | -              . $this->getReducedDQLQueryPart('where', ['pre' => ' WHERE ']) | 
                                                        |
| 1428 | -              . $this->getReducedDQLQueryPart('groupBy', ['pre' => ' GROUP BY ', 'separator' => ', ']) | 
                                                        |
| 1429 | -              . $this->getReducedDQLQueryPart('having', ['pre' => ' HAVING ']) | 
                                                        |
| 1430 | -              . $this->getReducedDQLQueryPart('orderBy', ['pre' => ' ORDER BY ', 'separator' => ', ']); | 
                                                        |
| 1427 | +                . $this->getReducedDQLQueryPart('where', ['pre' => ' WHERE ']) | 
                                                        |
| 1428 | +                . $this->getReducedDQLQueryPart('groupBy', ['pre' => ' GROUP BY ', 'separator' => ', ']) | 
                                                        |
| 1429 | +                . $this->getReducedDQLQueryPart('having', ['pre' => ' HAVING ']) | 
                                                        |
| 1430 | +                . $this->getReducedDQLQueryPart('orderBy', ['pre' => ' ORDER BY ', 'separator' => ', ']); | 
                                                        |
| 1431 | 1431 | |
| 1432 | 1432 | return $dql;  | 
                                                        
| 1433 | 1433 | }  | 
                                                        
@@ -1447,8 +1447,8 @@ discard block  | 
                                                    ||
| 1447 | 1447 | }  | 
                                                        
| 1448 | 1448 | |
| 1449 | 1449 | return (isset($options['pre']) ? $options['pre'] : '')  | 
                                                        
| 1450 | - . (is_array($queryPart) ? implode($options['separator'], $queryPart) : $queryPart)  | 
                                                        |
| 1451 | - . (isset($options['post']) ? $options['post'] : '');  | 
                                                        |
| 1450 | + . (is_array($queryPart) ? implode($options['separator'], $queryPart) : $queryPart)  | 
                                                        |
| 1451 | + . (isset($options['post']) ? $options['post'] : '');  | 
                                                        |
| 1452 | 1452 | }  | 
                                                        
| 1453 | 1453 | |
| 1454 | 1454 | /**  | 
                                                        
@@ -609,7 +609,7 @@ discard block  | 
                                                    ||
| 609 | 609 | /**  | 
                                                        
| 610 | 610 | * Gets a (previously set) query parameter of the query being constructed.  | 
                                                        
| 611 | 611 | *  | 
                                                        
| 612 | - * @param mixed $key The key (index or name) of the bound parameter.  | 
                                                        |
| 612 | + * @param string $key The key (index or name) of the bound parameter.  | 
                                                        |
| 613 | 613 | *  | 
                                                        
| 614 | 614 | * @return Query\Parameter|null The value of the bound parameter.  | 
                                                        
| 615 | 615 | */  | 
                                                        
@@ -1097,7 +1097,6 @@ discard block  | 
                                                    ||
| 1097 | 1097 |       *         ->andWhere('u.is_active = 1'); | 
                                                        
| 1098 | 1098 | * </code>  | 
                                                        
| 1099 | 1099 | *  | 
                                                        
| 1100 | - * @param mixed $where The query restrictions.  | 
                                                        |
| 1101 | 1100 | *  | 
                                                        
| 1102 | 1101 | * @return self  | 
                                                        
| 1103 | 1102 | *  | 
                                                        
@@ -1130,7 +1129,6 @@ discard block  | 
                                                    ||
| 1130 | 1129 |       *         ->orWhere('u.id = 2'); | 
                                                        
| 1131 | 1130 | * </code>  | 
                                                        
| 1132 | 1131 | *  | 
                                                        
| 1133 | - * @param mixed $where The WHERE statement.  | 
                                                        |
| 1134 | 1132 | *  | 
                                                        
| 1135 | 1133 | * @return self  | 
                                                        
| 1136 | 1134 | *  | 
                                                        
@@ -1195,7 +1193,7 @@ discard block  | 
                                                    ||
| 1195 | 1193 | * Specifies a restriction over the groups of the query.  | 
                                                        
| 1196 | 1194 | * Replaces any previous having restrictions, if any.  | 
                                                        
| 1197 | 1195 | *  | 
                                                        
| 1198 | - * @param mixed $having The restriction over the groups.  | 
                                                        |
| 1196 | + * @param string $having The restriction over the groups.  | 
                                                        |
| 1199 | 1197 | *  | 
                                                        
| 1200 | 1198 | * @return self  | 
                                                        
| 1201 | 1199 | */  | 
                                                        
@@ -1212,7 +1210,7 @@ discard block  | 
                                                    ||
| 1212 | 1210 | * Adds a restriction over the groups of the query, forming a logical  | 
                                                        
| 1213 | 1211 | * conjunction with any existing having restrictions.  | 
                                                        
| 1214 | 1212 | *  | 
                                                        
| 1215 | - * @param mixed $having The restriction to append.  | 
                                                        |
| 1213 | + * @param string $having The restriction to append.  | 
                                                        |
| 1216 | 1214 | *  | 
                                                        
| 1217 | 1215 | * @return self  | 
                                                        
| 1218 | 1216 | */  | 
                                                        
@@ -1235,7 +1233,7 @@ discard block  | 
                                                    ||
| 1235 | 1233 | * Adds a restriction over the groups of the query, forming a logical  | 
                                                        
| 1236 | 1234 | * disjunction with any existing having restrictions.  | 
                                                        
| 1237 | 1235 | *  | 
                                                        
| 1238 | - * @param mixed $having The restriction to add.  | 
                                                        |
| 1236 | + * @param string $having The restriction to add.  | 
                                                        |
| 1239 | 1237 | *  | 
                                                        
| 1240 | 1238 | * @return self  | 
                                                        
| 1241 | 1239 | */  | 
                                                        
@@ -1454,7 +1452,7 @@ discard block  | 
                                                    ||
| 1454 | 1452 | /**  | 
                                                        
| 1455 | 1453 | * Resets DQL parts.  | 
                                                        
| 1456 | 1454 | *  | 
                                                        
| 1457 | - * @param array|null $parts  | 
                                                        |
| 1455 | + * @param string[] $parts  | 
                                                        |
| 1458 | 1456 | *  | 
                                                        
| 1459 | 1457 | * @return self  | 
                                                        
| 1460 | 1458 | */  | 
                                                        
@@ -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;  | 
                                                        
| 6 | 6 | |
@@ -518,7 +518,7 @@ discard block  | 
                                                    ||
| 518 | 518 | public function setParameter($key, $value, $type = null)  | 
                                                        
| 519 | 519 |      { | 
                                                        
| 520 | 520 | $filteredParameters = $this->parameters->filter(  | 
                                                        
| 521 | - function ($parameter) use ($key)  | 
                                                        |
| 521 | + function($parameter) use ($key)  | 
                                                        |
| 522 | 522 |              { | 
                                                        
| 523 | 523 | /* @var Query\Parameter $parameter */  | 
                                                        
| 524 | 524 | // Must not be identical because of string to integer conversion  | 
                                                        
@@ -526,7 +526,7 @@ discard block  | 
                                                    ||
| 526 | 526 | }  | 
                                                        
| 527 | 527 | );  | 
                                                        
| 528 | 528 | |
| 529 | -        if (! $filteredParameters->isEmpty()) { | 
                                                        |
| 529 | +        if ( ! $filteredParameters->isEmpty()) { | 
                                                        |
| 530 | 530 | /* @var Query\Parameter $parameter */  | 
                                                        
| 531 | 531 | $parameter = $filteredParameters->first();  | 
                                                        
| 532 | 532 | $parameter->setValue($value, $type);  | 
                                                        
@@ -599,7 +599,7 @@ discard block  | 
                                                    ||
| 599 | 599 | public function getParameter($key)  | 
                                                        
| 600 | 600 |      { | 
                                                        
| 601 | 601 | $filteredParameters = $this->parameters->filter(  | 
                                                        
| 602 | - function ($parameter) use ($key)  | 
                                                        |
| 602 | + function($parameter) use ($key)  | 
                                                        |
| 603 | 603 |              { | 
                                                        
| 604 | 604 | /* @var Query\Parameter $parameter */  | 
                                                        
| 605 | 605 | // Must not be identical because of string to integer conversion  | 
                                                        
@@ -682,7 +682,7 @@ discard block  | 
                                                    ||
| 682 | 682 | }  | 
                                                        
| 683 | 683 | |
| 684 | 684 | $isMultiple = is_array($this->dqlParts[$dqlPartName])  | 
                                                        
| 685 | - && !($dqlPartName == 'join' && !$append);  | 
                                                        |
| 685 | + && ! ($dqlPartName == 'join' && ! $append);  | 
                                                        |
| 686 | 686 | |
| 687 | 687 | // Allow adding any part retrieved from self::getDQLParts().  | 
                                                        
| 688 | 688 |          if (is_array($dqlPart) && $dqlPartName != 'join') { | 
                                                        
@@ -899,7 +899,7 @@ discard block  | 
                                                    ||
| 899 | 899 |      { | 
                                                        
| 900 | 900 | $rootAliases = $this->getRootAliases();  | 
                                                        
| 901 | 901 | |
| 902 | -        if (!in_array($alias, $rootAliases)) { | 
                                                        |
| 902 | +        if ( ! in_array($alias, $rootAliases)) { | 
                                                        |
| 903 | 903 | throw new Query\QueryException(  | 
                                                        
| 904 | 904 |                  sprintf('Specified root alias %s must be set before invoking indexBy().', $alias) | 
                                                        
| 905 | 905 | );  | 
                                                        
@@ -1301,15 +1301,15 @@ discard block  | 
                                                    ||
| 1301 | 1301 |              foreach ($criteria->getOrderings() as $sort => $order) { | 
                                                        
| 1302 | 1302 | |
| 1303 | 1303 | $hasValidAlias = false;  | 
                                                        
| 1304 | -                foreach($allAliases as $alias) { | 
                                                        |
| 1305 | -                    if(strpos($sort . '.', $alias . '.') === 0) { | 
                                                        |
| 1304 | +                foreach ($allAliases as $alias) { | 
                                                        |
| 1305 | +                    if (strpos($sort.'.', $alias.'.') === 0) { | 
                                                        |
| 1306 | 1306 | $hasValidAlias = true;  | 
                                                        
| 1307 | 1307 | break;  | 
                                                        
| 1308 | 1308 | }  | 
                                                        
| 1309 | 1309 | }  | 
                                                        
| 1310 | 1310 | |
| 1311 | -                if(!$hasValidAlias) { | 
                                                        |
| 1312 | - $sort = $allAliases[0] . '.' . $sort;  | 
                                                        |
| 1311 | +                if ( ! $hasValidAlias) { | 
                                                        |
| 1312 | + $sort = $allAliases[0].'.'.$sort;  | 
                                                        |
| 1313 | 1313 | }  | 
                                                        
| 1314 | 1314 | |
| 1315 | 1315 | $this->addOrderBy($sort, $order);  | 
                                                        
@@ -1382,7 +1382,7 @@ discard block  | 
                                                    ||
| 1382 | 1382 | private function getDQLForSelect()  | 
                                                        
| 1383 | 1383 |      { | 
                                                        
| 1384 | 1384 | $dql = 'SELECT'  | 
                                                        
| 1385 | - . ($this->dqlParts['distinct']===true ? ' DISTINCT' : '')  | 
                                                        |
| 1385 | + . ($this->dqlParts['distinct'] === true ? ' DISTINCT' : '')  | 
                                                        |
| 1386 | 1386 |               . $this->getReducedDQLQueryPart('select', ['pre' => ' ', 'separator' => ', ']); | 
                                                        
| 1387 | 1387 | |
| 1388 | 1388 |          $fromParts   = $this->getDQLPart('from'); | 
                                                        
@@ -1398,7 +1398,7 @@ discard block  | 
                                                    ||
| 1398 | 1398 | |
| 1399 | 1399 |                  if ($from instanceof Expr\From && isset($joinParts[$from->getAlias()])) { | 
                                                        
| 1400 | 1400 |                      foreach ($joinParts[$from->getAlias()] as $join) { | 
                                                        
| 1401 | - $fromClause .= ' ' . ((string) $join);  | 
                                                        |
| 1401 | + $fromClause .= ' '.((string) $join);  | 
                                                        |
| 1402 | 1402 | }  | 
                                                        
| 1403 | 1403 | }  | 
                                                        
| 1404 | 1404 | |
@@ -12,11 +12,11 @@  | 
                                                    ||
| 12 | 12 | use Entities\Address;  | 
                                                        
| 13 | 13 | use Entities\User;  | 
                                                        
| 14 | 14 | |
| 15 | -$em = require_once __DIR__ . '/bootstrap.php';  | 
                                                        |
| 15 | +$em = require_once __DIR__.'/bootstrap.php';  | 
                                                        |
| 16 | 16 | |
| 17 | 17 | ## PUT YOUR TEST CODE BELOW  | 
                                                        
| 18 | 18 | |
| 19 | 19 | $user = new User;  | 
                                                        
| 20 | 20 | $address = new Address;  | 
                                                        
| 21 | 21 | |
| 22 | -echo 'Hello World!' . PHP_EOL;  | 
                                                        |
| 22 | +echo 'Hello World!'.PHP_EOL;  | 
                                                        |
@@ -74,7 +74,7 @@ discard block  | 
                                                    ||
| 74 | 74 |              foreach ($props as $name => $prop) { | 
                                                        
| 75 | 75 | $ident += 4;  | 
                                                        
| 76 | 76 |                  $str .= str_repeat(' ', $ident) . '"' . $name . '": ' | 
                                                        
| 77 | - . $this->dump($prop) . ',' . PHP_EOL;  | 
                                                        |
| 77 | + . $this->dump($prop) . ',' . PHP_EOL;  | 
                                                        |
| 78 | 78 | $ident -= 4;  | 
                                                        
| 79 | 79 | }  | 
                                                        
| 80 | 80 | |
@@ -86,7 +86,7 @@ discard block  | 
                                                    ||
| 86 | 86 | |
| 87 | 87 |              foreach ($obj as $k => $v) { | 
                                                        
| 88 | 88 |                  $str .= PHP_EOL . str_repeat(' ', $ident) . '"' | 
                                                        
| 89 | - . $k . '" => ' . $this->dump($v) . ',';  | 
                                                        |
| 89 | + . $k . '" => ' . $this->dump($v) . ',';  | 
                                                        |
| 90 | 90 | $some = true;  | 
                                                        
| 91 | 91 | }  | 
                                                        
| 92 | 92 | |
@@ -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\AST;  | 
                                                        
| 6 | 6 | |
@@ -53,32 +53,32 @@ discard block  | 
                                                    ||
| 53 | 53 | $str = '';  | 
                                                        
| 54 | 54 | |
| 55 | 55 |          if ($obj instanceof Node) { | 
                                                        
| 56 | -            $str .= get_class($obj) . '(' . PHP_EOL; | 
                                                        |
| 56 | +            $str .= get_class($obj).'('.PHP_EOL; | 
                                                        |
| 57 | 57 | $props = get_object_vars($obj);  | 
                                                        
| 58 | 58 | |
| 59 | 59 |              foreach ($props as $name => $prop) { | 
                                                        
| 60 | 60 | $ident += 4;  | 
                                                        
| 61 | -                $str .= str_repeat(' ', $ident) . '"' . $name . '": ' | 
                                                        |
| 62 | - . $this->dump($prop) . ',' . PHP_EOL;  | 
                                                        |
| 61 | +                $str .= str_repeat(' ', $ident).'"'.$name.'": ' | 
                                                        |
| 62 | + . $this->dump($prop).','.PHP_EOL;  | 
                                                        |
| 63 | 63 | $ident -= 4;  | 
                                                        
| 64 | 64 | }  | 
                                                        
| 65 | 65 | |
| 66 | -            $str .= str_repeat(' ', $ident) . ')'; | 
                                                        |
| 66 | +            $str .= str_repeat(' ', $ident).')'; | 
                                                        |
| 67 | 67 |          } else if (is_array($obj)) { | 
                                                        
| 68 | 68 | $ident += 4;  | 
                                                        
| 69 | 69 |              $str .= 'array('; | 
                                                        
| 70 | 70 | $some = false;  | 
                                                        
| 71 | 71 | |
| 72 | 72 |              foreach ($obj as $k => $v) { | 
                                                        
| 73 | -                $str .= PHP_EOL . str_repeat(' ', $ident) . '"' | 
                                                        |
| 74 | - . $k . '" => ' . $this->dump($v) . ',';  | 
                                                        |
| 73 | +                $str .= PHP_EOL.str_repeat(' ', $ident).'"' | 
                                                        |
| 74 | + . $k.'" => '.$this->dump($v).',';  | 
                                                        |
| 75 | 75 | $some = true;  | 
                                                        
| 76 | 76 | }  | 
                                                        
| 77 | 77 | |
| 78 | 78 | $ident -= 4;  | 
                                                        
| 79 | -            $str .= ($some ? PHP_EOL . str_repeat(' ', $ident) : '') . ')'; | 
                                                        |
| 79 | +            $str .= ($some ? PHP_EOL . str_repeat(' ', $ident) : '').')'; | 
                                                        |
| 80 | 80 |          } else if (is_object($obj)) { | 
                                                        
| 81 | -            $str .= 'instanceof(' . get_class($obj) . ')'; | 
                                                        |
| 81 | +            $str .= 'instanceof('.get_class($obj).')'; | 
                                                        |
| 82 | 82 |          } else { | 
                                                        
| 83 | 83 | $str .= var_export($obj, true);  | 
                                                        
| 84 | 84 | }  | 
                                                        
@@ -138,8 +138,8 @@  | 
                                                    ||
| 138 | 138 | public function __toString()  | 
                                                        
| 139 | 139 |      { | 
                                                        
| 140 | 140 | return strtoupper($this->joinType) . ' JOIN ' . $this->join  | 
                                                        
| 141 | - . ($this->alias ? ' ' . $this->alias : '')  | 
                                                        |
| 142 | - . ($this->indexBy ? ' INDEX BY ' . $this->indexBy : '')  | 
                                                        |
| 143 | - . ($this->condition ? ' ' . strtoupper($this->conditionType) . ' ' . $this->condition : '');  | 
                                                        |
| 141 | + . ($this->alias ? ' ' . $this->alias : '')  | 
                                                        |
| 142 | + . ($this->indexBy ? ' INDEX BY ' . $this->indexBy : '')  | 
                                                        |
| 143 | + . ($this->condition ? ' ' . strtoupper($this->conditionType) . ' ' . $this->condition : '');  | 
                                                        |
| 144 | 144 | }  | 
                                                        
| 145 | 145 | }  | 
                                                        
@@ -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\Expr;  | 
                                                        
| 6 | 6 | |
@@ -122,9 +122,9 @@ discard block  | 
                                                    ||
| 122 | 122 | */  | 
                                                        
| 123 | 123 | public function __toString()  | 
                                                        
| 124 | 124 |      { | 
                                                        
| 125 | - return strtoupper($this->joinType) . ' JOIN ' . $this->join  | 
                                                        |
| 126 | - . ($this->alias ? ' ' . $this->alias : '')  | 
                                                        |
| 127 | - . ($this->indexBy ? ' INDEX BY ' . $this->indexBy : '')  | 
                                                        |
| 128 | - . ($this->condition ? ' ' . strtoupper($this->conditionType) . ' ' . $this->condition : '');  | 
                                                        |
| 125 | + return strtoupper($this->joinType).' JOIN '.$this->join  | 
                                                        |
| 126 | + . ($this->alias ? ' '.$this->alias : '')  | 
                                                        |
| 127 | + . ($this->indexBy ? ' INDEX BY '.$this->indexBy : '')  | 
                                                        |
| 128 | + . ($this->condition ? ' '.strtoupper($this->conditionType).' '.$this->condition : '');  | 
                                                        |
| 129 | 129 | }  | 
                                                        
| 130 | 130 | }  | 
                                                        
@@ -227,7 +227,9 @@  | 
                                                    ||
| 227 | 227 | $found = false;  | 
                                                        
| 228 | 228 | |
| 229 | 229 |          foreach (array_merge($this->metaMappings, $this->fieldMappings) as $columnName => $columnFieldName) { | 
                                                        
| 230 | - if ( ! ($columnFieldName === $fieldName && $this->columnOwnerMap[$columnName] === $alias)) continue;  | 
                                                        |
| 230 | +            if ( ! ($columnFieldName === $fieldName && $this->columnOwnerMap[$columnName] === $alias)) { | 
                                                        |
| 231 | + continue;  | 
                                                        |
| 232 | + }  | 
                                                        |
| 231 | 233 | |
| 232 | 234 | $this->addIndexByColumn($alias, $columnName);  | 
                                                        
| 233 | 235 | $found = true;  | 
                                                        
@@ -1,6 +1,6 @@  | 
                                                    ||
| 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 | use Doctrine\DBAL\Types\Type;  | 
                                                        
@@ -212,10 +212,10 @@  | 
                                                    ||
| 212 | 212 | }  | 
                                                        
| 213 | 213 | |
| 214 | 214 | /**  | 
                                                        
| 215 | - * Obtain the name of the second level query cache region in which query results will be stored  | 
                                                        |
| 216 | - *  | 
                                                        |
| 217 | - * @return string|null The cache region name; NULL indicates the default region.  | 
                                                        |
| 218 | - */  | 
                                                        |
| 215 | + * Obtain the name of the second level query cache region in which query results will be stored  | 
                                                        |
| 216 | + *  | 
                                                        |
| 217 | + * @return string|null The cache region name; NULL indicates the default region.  | 
                                                        |
| 218 | + */  | 
                                                        |
| 219 | 219 | public function getCacheRegion()  | 
                                                        
| 220 | 220 |      { | 
                                                        
| 221 | 221 | return $this->cacheRegion;  | 
                                                        
@@ -1044,7 +1044,7 @@  | 
                                                    ||
| 1044 | 1044 | * Will return the configured id if it exists otherwise a hash will be  | 
                                                        
| 1045 | 1045 | * automatically generated for you.  | 
                                                        
| 1046 | 1046 | *  | 
                                                        
| 1047 | - * @return array ($key, $hash)  | 
                                                        |
| 1047 | + * @return string[] ($key, $hash)  | 
                                                        |
| 1048 | 1048 | */  | 
                                                        
| 1049 | 1049 | protected function getHydrationCacheId()  | 
                                                        
| 1050 | 1050 |      { | 
                                                        
@@ -1,11 +1,11 @@ discard block  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | |
| 3 | -declare(strict_types=1);  | 
                                                        |
| 3 | +declare(strict_types = 1);  | 
                                                        |
| 4 | 4 | |
| 5 | 5 | namespace Doctrine\ORM;  | 
                                                        
| 6 | 6 | |
| 7 | 7 | use Doctrine\Common\Collections\Collection;  | 
                                                        
| 8 | -use Doctrine\Common\Collections\ArrayCollection;;  | 
                                                        |
| 8 | +use Doctrine\Common\Collections\ArrayCollection; ;  | 
                                                        |
| 9 | 9 | use Doctrine\ORM\Query\Parameter;  | 
                                                        
| 10 | 10 | use Doctrine\ORM\Cache\QueryCacheKey;  | 
                                                        
| 11 | 11 | use Doctrine\DBAL\Cache\QueryCacheProfile;  | 
                                                        
@@ -305,7 +305,7 @@ discard block  | 
                                                    ||
| 305 | 305 | public function getParameter($key)  | 
                                                        
| 306 | 306 |      { | 
                                                        
| 307 | 307 | $filteredParameters = $this->parameters->filter(  | 
                                                        
| 308 | - function ($parameter) use ($key)  | 
                                                        |
| 308 | + function($parameter) use ($key)  | 
                                                        |
| 309 | 309 |              { | 
                                                        
| 310 | 310 | // Must not be identical because of string to integer conversion  | 
                                                        
| 311 | 311 | return ($key == $parameter->getName());  | 
                                                        
@@ -354,14 +354,14 @@ discard block  | 
                                                    ||
| 354 | 354 | public function setParameter($key, $value, $type = null)  | 
                                                        
| 355 | 355 |      { | 
                                                        
| 356 | 356 | $filteredParameters = $this->parameters->filter(  | 
                                                        
| 357 | - function ($parameter) use ($key)  | 
                                                        |
| 357 | + function($parameter) use ($key)  | 
                                                        |
| 358 | 358 |              { | 
                                                        
| 359 | 359 | // Must not be identical because of string to integer conversion  | 
                                                        
| 360 | 360 | return ($key == $parameter->getName());  | 
                                                        
| 361 | 361 | }  | 
                                                        
| 362 | 362 | );  | 
                                                        
| 363 | 363 | |
| 364 | -        if (! $filteredParameters->isEmpty()) { | 
                                                        |
| 364 | +        if ( ! $filteredParameters->isEmpty()) { | 
                                                        |
| 365 | 365 | $parameter = $filteredParameters->first();  | 
                                                        
| 366 | 366 | $parameter->setValue($value, $type);  | 
                                                        
| 367 | 367 | |
@@ -450,7 +450,7 @@ discard block  | 
                                                    ||
| 450 | 450 | */  | 
                                                        
| 451 | 451 | private function translateNamespaces(Query\ResultSetMapping $rsm)  | 
                                                        
| 452 | 452 |      { | 
                                                        
| 453 | -        $translate = function ($alias) { | 
                                                        |
| 453 | +        $translate = function($alias) { | 
                                                        |
| 454 | 454 | return $this->em->getClassMetadata($alias)->getClassName();  | 
                                                        
| 455 | 455 | };  | 
                                                        
| 456 | 456 | |
@@ -512,7 +512,7 @@ discard block  | 
                                                    ||
| 512 | 512 | */  | 
                                                        
| 513 | 513 | public function setResultCacheProfile(QueryCacheProfile $profile = null)  | 
                                                        
| 514 | 514 |      { | 
                                                        
| 515 | -        if (! $profile->getResultCacheDriver()) { | 
                                                        |
| 515 | +        if ( ! $profile->getResultCacheDriver()) { | 
                                                        |
| 516 | 516 | $resultCacheDriver = $this->em->getConfiguration()->getResultCacheImpl();  | 
                                                        
| 517 | 517 | $profile = $profile->setResultCacheDriver($resultCacheDriver);  | 
                                                        
| 518 | 518 | }  | 
                                                        
@@ -980,7 +980,7 @@ discard block  | 
                                                    ||
| 980 | 980 | $this->getTimestampKey()  | 
                                                        
| 981 | 981 | );  | 
                                                        
| 982 | 982 | |
| 983 | - $result = $queryCache->get($queryKey, $rsm, $this->hints);  | 
                                                        |
| 983 | + $result = $queryCache->get($queryKey, $rsm, $this->hints);  | 
                                                        |
| 984 | 984 | |
| 985 | 985 |          if ($result !== null) { | 
                                                        
| 986 | 986 |              if ($this->cacheLogger) { | 
                                                        
@@ -1114,6 +1114,6 @@ discard block  | 
                                                    ||
| 1114 | 1114 | |
| 1115 | 1115 | ksort($hints);  | 
                                                        
| 1116 | 1116 | |
| 1117 | - return sha1($query . '-' . serialize($params) . '-' . serialize($hints));  | 
                                                        |
| 1117 | + return sha1($query.'-'.serialize($params).'-'.serialize($hints));  | 
                                                        |
| 1118 | 1118 | }  | 
                                                        
| 1119 | 1119 | }  | 
                                                        
@@ -45,9 +45,9 @@ discard block  | 
                                                    ||
| 45 | 45 | */  | 
                                                        
| 46 | 46 | private $uow;  | 
                                                        
| 47 | 47 | |
| 48 | - /**  | 
                                                        |
| 49 | - * @var \Doctrine\ORM\Cache\CacheFactory  | 
                                                        |
| 50 | - */  | 
                                                        |
| 48 | + /**  | 
                                                        |
| 49 | + * @var \Doctrine\ORM\Cache\CacheFactory  | 
                                                        |
| 50 | + */  | 
                                                        |
| 51 | 51 | private $cacheFactory;  | 
                                                        
| 52 | 52 | |
| 53 | 53 | /**  | 
                                                        
@@ -289,12 +289,12 @@ discard block  | 
                                                    ||
| 289 | 289 | return $this->queryCaches[$regionName];  | 
                                                        
| 290 | 290 | }  | 
                                                        
| 291 | 291 | |
| 292 | - /**  | 
                                                        |
| 293 | - * @param \Doctrine\ORM\Mapping\ClassMetadata $metadata The entity metadata.  | 
                                                        |
| 294 | - * @param mixed $identifier The entity identifier.  | 
                                                        |
| 295 | - *  | 
                                                        |
| 296 | - * @return \Doctrine\ORM\Cache\EntityCacheKey  | 
                                                        |
| 297 | - */  | 
                                                        |
| 292 | + /**  | 
                                                        |
| 293 | + * @param \Doctrine\ORM\Mapping\ClassMetadata $metadata The entity metadata.  | 
                                                        |
| 294 | + * @param mixed $identifier The entity identifier.  | 
                                                        |
| 295 | + *  | 
                                                        |
| 296 | + * @return \Doctrine\ORM\Cache\EntityCacheKey  | 
                                                        |
| 297 | + */  | 
                                                        |
| 298 | 298 | private function buildEntityCacheKey(ClassMetadata $metadata, $identifier)  | 
                                                        
| 299 | 299 |      { | 
                                                        
| 300 | 300 |          if ( ! is_array($identifier)) { | 
                                                        
@@ -1,7 +1,7 @@ discard block  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | |
| 3 | 3 | |
| 4 | -declare(strict_types=1);  | 
                                                        |
| 4 | +declare(strict_types = 1);  | 
                                                        |
| 5 | 5 | |
| 6 | 6 | namespace Doctrine\ORM\Cache;  | 
                                                        
| 7 | 7 | |
@@ -205,7 +205,7 @@ discard block  | 
                                                    ||
| 205 | 205 | |
| 206 | 206 |          foreach ($metadatas as $metadata) { | 
                                                        
| 207 | 207 |              foreach ($metadata->getDeclaredPropertiesIterator() as $association) { | 
                                                        
| 208 | -                if (! $association instanceof ToManyAssociationMetadata) { | 
                                                        |
| 208 | +                if ( ! $association instanceof ToManyAssociationMetadata) { | 
                                                        |
| 209 | 209 | continue;  | 
                                                        
| 210 | 210 | }  | 
                                                        
| 211 | 211 | |
@@ -262,8 +262,7 @@ discard block  | 
                                                    ||
| 262 | 262 | public function getQueryCache($regionName = null)  | 
                                                        
| 263 | 263 |      { | 
                                                        
| 264 | 264 |          if ($regionName === null) { | 
                                                        
| 265 | - return $this->defaultQueryCache ?:  | 
                                                        |
| 266 | - $this->defaultQueryCache = $this->cacheFactory->buildQueryCache($this->em);  | 
                                                        |
| 265 | + return $this->defaultQueryCache ?: $this->defaultQueryCache = $this->cacheFactory->buildQueryCache($this->em);  | 
                                                        |
| 267 | 266 | }  | 
                                                        
| 268 | 267 | |
| 269 | 268 |          if ( ! isset($this->queryCaches[$regionName])) { |