Failed Conditions
Pull Request — develop (#6935)
by Michael
65:23
created
tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Doctrine\Tests\ORM\Query;
6 6
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
             $this->addToAssertionCount(1);
31 31
         } catch (QueryException $e) {
32 32
             if ($debug) {
33
-                echo $e->getTraceAsString() . PHP_EOL;
33
+                echo $e->getTraceAsString().PHP_EOL;
34 34
             }
35 35
 
36 36
             $this->fail($e->getMessage());
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
             $this->fail('No syntax errors were detected, when syntax errors were expected');
46 46
         } catch (QueryException $e) {
47 47
             if ($debug) {
48
-                echo $e->getMessage() . PHP_EOL;
49
-                echo $e->getTraceAsString() . PHP_EOL;
48
+                echo $e->getMessage().PHP_EOL;
49
+                echo $e->getTraceAsString().PHP_EOL;
50 50
             }
51 51
             $this->addToAssertionCount(1);
52 52
         }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             ['SELECT foo: FROM Doctrine\Tests\Models\CMS\CmsUser foo:'],
109 109
 
110 110
             /* Checks for invalid AbstractSchemaName */
111
-            ['SELECT u FROM UnknownClass u'],  // unknown
111
+            ['SELECT u FROM UnknownClass u'], // unknown
112 112
             ['SELECT u FROM \Unknown\Class u'], // unknown, leading backslash
113 113
             ['SELECT u FROM Unknown\\\\Class u'], // unknown, syntactically bogus (duplicate \\)
114 114
             ['SELECT u FROM Unknown\Class\ u'], // unknown, syntactically bogus (trailing \)
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
      */
575 575
     public function testDQLKeywordInJoinIsAllowed()
576 576
     {
577
-        self::assertValidDQL('SELECT u FROM ' . __NAMESPACE__ . '\DQLKeywordsModelUser u JOIN u.group g');
577
+        self::assertValidDQL('SELECT u FROM '.__NAMESPACE__.'\DQLKeywordsModelUser u JOIN u.group g');
578 578
     }
579 579
 
580 580
     /**
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
      */
583 583
     public function testDQLKeywordInConditionIsAllowed()
584 584
     {
585
-        self::assertValidDQL('SELECT g FROM ' . __NAMESPACE__ . '\DQLKeywordsModelGroup g WHERE g.from=0');
585
+        self::assertValidDQL('SELECT g FROM '.__NAMESPACE__.'\DQLKeywordsModelGroup g WHERE g.from=0');
586 586
     }
587 587
 
588 588
     /* The exception is currently thrown in the SQLWalker, not earlier.
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
      */
688 688
     public function testNewLiteralExpression()
689 689
     {
690
-        self::assertValidDQL("SELECT new " . __NAMESPACE__ . "\\DummyStruct(u.id, 'foo', 1, true) FROM Doctrine\Tests\Models\CMS\CmsUser u");
690
+        self::assertValidDQL("SELECT new ".__NAMESPACE__."\\DummyStruct(u.id, 'foo', 1, true) FROM Doctrine\Tests\Models\CMS\CmsUser u");
691 691
     }
692 692
 
693 693
     /**
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
      */
696 696
     public function testNewLiteralWithSubselectExpression()
697 697
     {
698
-        self::assertValidDQL("SELECT new " . __NAMESPACE__ . "\\DummyStruct(u.id, 'foo', (SELECT 1 FROM Doctrine\Tests\Models\CMS\CmsUser su), true) FROM Doctrine\Tests\Models\CMS\CmsUser u");
698
+        self::assertValidDQL("SELECT new ".__NAMESPACE__."\\DummyStruct(u.id, 'foo', (SELECT 1 FROM Doctrine\Tests\Models\CMS\CmsUser su), true) FROM Doctrine\Tests\Models\CMS\CmsUser u");
699 699
     }
700 700
 }
701 701
 
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -135,13 +135,13 @@
 block discarded – undo
135 135
         $cmf = new ClassMetadataFactory();
136 136
         $driver = $this->createMock(MappingDriver::class);
137 137
         $driver->expects($this->at(0))
138
-               ->method('isTransient')
139
-               ->with($this->equalTo(CmsUser::class))
140
-               ->will($this->returnValue(true));
138
+                ->method('isTransient')
139
+                ->with($this->equalTo(CmsUser::class))
140
+                ->will($this->returnValue(true));
141 141
         $driver->expects($this->at(1))
142
-               ->method('isTransient')
143
-               ->with($this->equalTo(CmsArticle::class))
144
-               ->will($this->returnValue(false));
142
+                ->method('isTransient')
143
+                ->with($this->equalTo(CmsArticle::class))
144
+                ->will($this->returnValue(false));
145 145
 
146 146
         $em = $this->createEntityManager($driver);
147 147
 
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Functional/QueryTest.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         $this->expectExceptionMessage('Too few parameters: the query defines 1 parameters but you only bound 0');
151 151
 
152 152
         $this->em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1')
153
-                  ->getSingleResult();
153
+                    ->getSingleResult();
154 154
     }
155 155
 
156 156
     public function testInvalidInputParameterThrowsException()
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
         $this->expectException(QueryException::class);
159 159
 
160 160
         $this->em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?')
161
-                  ->setParameter(1, 'jwage')
162
-                  ->getSingleResult();
161
+                    ->setParameter(1, 'jwage')
162
+                    ->getSingleResult();
163 163
     }
164 164
 
165 165
     public function testSetParameters()
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
         $parameters->add(new Parameter(2, 'active'));
170 170
 
171 171
         $this->em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1 AND u.status = ?2')
172
-                  ->setParameters($parameters)
173
-                  ->getResult();
172
+                    ->setParameters($parameters)
173
+                    ->getResult();
174 174
 
175 175
         $extractValue = function (Parameter $parameter) {
176 176
             return $parameter->getValue();
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
         $parameters = [1 => 'jwage', 2 => 'active'];
188 188
 
189 189
         $this->em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1 AND u.status = ?2')
190
-                  ->setParameters($parameters)
191
-                  ->getResult();
190
+                    ->setParameters($parameters)
191
+                    ->getResult();
192 192
 
193 193
         self::assertSame(
194 194
             array_values($parameters),
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
     public function testGetSingleResultThrowsExceptionOnNoResult()
333 333
     {
334 334
         $this->em->createQuery("select a from Doctrine\Tests\Models\CMS\CmsArticle a")
335
-             ->getSingleResult();
335
+                ->getSingleResult();
336 336
     }
337 337
 
338 338
     /**
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
     public function testGetSingleScalarResultThrowsExceptionOnNoResult()
342 342
     {
343 343
         $this->em->createQuery("select a from Doctrine\Tests\Models\CMS\CmsArticle a")
344
-             ->getSingleScalarResult();
344
+                ->getSingleScalarResult();
345 345
     }
346 346
 
347 347
     /**
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
         $this->em->clear();
373 373
 
374 374
         $this->em->createQuery("select a from Doctrine\Tests\Models\CMS\CmsArticle a")
375
-             ->getSingleScalarResult();
375
+                ->getSingleScalarResult();
376 376
     }
377 377
 
378 378
     public function testModifiedLimitQuery()
@@ -389,27 +389,27 @@  discard block
 block discarded – undo
389 389
         $this->em->clear();
390 390
 
391 391
         $data = $this->em->createQuery('SELECT u FROM ' . CmsUser::class . ' u')
392
-                  ->setFirstResult(1)
393
-                  ->setMaxResults(2)
394
-                  ->getResult();
392
+                    ->setFirstResult(1)
393
+                    ->setMaxResults(2)
394
+                    ->getResult();
395 395
 
396 396
         self::assertCount(2, $data);
397 397
         self::assertEquals('gblanco1', $data[0]->username);
398 398
         self::assertEquals('gblanco2', $data[1]->username);
399 399
 
400 400
         $data = $this->em->createQuery('SELECT u FROM ' . CmsUser::class . ' u')
401
-                  ->setFirstResult(3)
402
-                  ->setMaxResults(2)
403
-                  ->getResult();
401
+                    ->setFirstResult(3)
402
+                    ->setMaxResults(2)
403
+                    ->getResult();
404 404
 
405 405
         self::assertCount(2, $data);
406 406
         self::assertEquals('gblanco3', $data[0]->username);
407 407
         self::assertEquals('gblanco4', $data[1]->username);
408 408
 
409 409
         $data = $this->em->createQuery('SELECT u FROM ' . CmsUser::class . ' u')
410
-                  ->setFirstResult(3)
411
-                  ->setMaxResults(2)
412
-                  ->getScalarResult();
410
+                    ->setFirstResult(3)
411
+                    ->setMaxResults(2)
412
+                    ->getScalarResult();
413 413
     }
414 414
 
415 415
     /**
@@ -620,9 +620,9 @@  discard block
 block discarded – undo
620 620
     {
621 621
         $qb = $this->em->createQueryBuilder();
622 622
         $qb->select('u')
623
-           ->from(CmsUser::class, 'u')
624
-           ->innerJoin('u.articles', 'a')
625
-           ->where('(u.id = 0) OR (u.id IS NULL)');
623
+            ->from(CmsUser::class, 'u')
624
+            ->innerJoin('u.articles', 'a')
625
+            ->where('(u.id = 0) OR (u.id IS NULL)');
626 626
 
627 627
         $query = $qb->getQuery();
628 628
         $users = $query->execute();
Please login to merge, or discard this patch.
lib/Doctrine/ORM/AbstractQuery.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Doctrine\ORM;
6 6
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
      */
495 495
     public function setResultCacheProfile(QueryCacheProfile $profile = null)
496 496
     {
497
-        if (! $profile->getResultCacheDriver()) {
497
+        if ( ! $profile->getResultCacheDriver()) {
498 498
             $resultCacheDriver = $this->em->getConfiguration()->getResultCacheImpl();
499 499
             $profile = $profile->setResultCacheDriver($resultCacheDriver);
500 500
         }
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
             $this->getTimestampKey()
963 963
         );
964 964
 
965
-        $result     = $queryCache->get($queryKey, $rsm, $this->hints);
965
+        $result = $queryCache->get($queryKey, $rsm, $this->hints);
966 966
 
967 967
         if ($result !== null) {
968 968
             if ($this->cacheLogger) {
@@ -1096,6 +1096,6 @@  discard block
 block discarded – undo
1096 1096
 
1097 1097
         ksort($hints);
1098 1098
 
1099
-        return sha1($query . '-' . serialize($params) . '-' . serialize($hints));
1099
+        return sha1($query.'-'.serialize($params).'-'.serialize($hints));
1100 1100
     }
1101 1101
 }
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Query/Parser.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
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,
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
             // If the namespace is not given then assumes the first FROM entity namespace
619 619
             if (strpos($className, '\\') === false && ! class_exists($className) && strpos($fromClassName, '\\') !== false) {
620 620
                 $namespace  = substr($fromClassName, 0, strrpos($fromClassName, '\\'));
621
-                $fqcn       = $namespace . '\\' . $className;
621
+                $fqcn       = $namespace.'\\'.$className;
622 622
 
623 623
                 if (class_exists($fqcn)) {
624 624
                     $expression->className  = $fqcn;
@@ -667,13 +667,13 @@  discard block
 block discarded – undo
667 667
                 }
668 668
 
669 669
                 $this->semanticalError(
670
-                    "There is no mapped field named '$field' on class " . $class->getClassName() . ".", $deferredItem['token']
670
+                    "There is no mapped field named '$field' on class ".$class->getClassName().".", $deferredItem['token']
671 671
                 );
672 672
             }
673 673
 
674 674
             if (array_intersect($class->identifier, $expr->partialFieldSet) != $class->identifier) {
675 675
                 $this->semanticalError(
676
-                    "The partial field selection of class " . $class->getClassName() . " must contain the identifier.",
676
+                    "The partial field selection of class ".$class->getClassName()." must contain the identifier.",
677 677
                     $deferredItem['token']
678 678
                 );
679 679
             }
@@ -742,9 +742,9 @@  discard block
 block discarded – undo
742 742
             $property = $class->getProperty($field);
743 743
 
744 744
             // Check if field or association exists
745
-            if (! $property) {
745
+            if ( ! $property) {
746 746
                 $this->semanticalError(
747
-                    'Class ' . $class->getClassName() . ' has no field or association named ' . $field,
747
+                    'Class '.$class->getClassName().' has no field or association named '.$field,
748 748
                     $deferredItem['token']
749 749
                 );
750 750
             }
@@ -783,8 +783,8 @@  discard block
 block discarded – undo
783 783
                 // Build the error message
784 784
                 $semanticalError  = 'Invalid PathExpression. ';
785 785
                 $semanticalError .= \count($expectedStringTypes) === 1
786
-                    ? 'Must be a ' . $expectedStringTypes[0] . '.'
787
-                    : implode(' or ', $expectedStringTypes) . ' expected.';
786
+                    ? 'Must be a '.$expectedStringTypes[0].'.'
787
+                    : implode(' or ', $expectedStringTypes).' expected.';
788 788
 
789 789
                 $this->semanticalError($semanticalError, $deferredItem['token']);
790 790
             }
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
 
1030 1030
         if ( ! isset($this->queryComponents[$identVariable])) {
1031 1031
             $this->semanticalError(
1032
-                'Identification Variable ' . $identVariable .' used in join path expression but was not defined before.'
1032
+                'Identification Variable '.$identVariable.' used in join path expression but was not defined before.'
1033 1033
             );
1034 1034
         }
1035 1035
 
@@ -1042,8 +1042,8 @@  discard block
 block discarded – undo
1042 1042
         $qComp = $this->queryComponents[$identVariable];
1043 1043
         $class = $qComp['metadata'];
1044 1044
 
1045
-        if (! (($property = $class->getProperty($field)) !== null && $property instanceof AssociationMetadata)) {
1046
-            $this->semanticalError('Class ' . $class->getClassName() . ' has no association named ' . $field);
1045
+        if ( ! (($property = $class->getProperty($field)) !== null && $property instanceof AssociationMetadata)) {
1046
+            $this->semanticalError('Class '.$class->getClassName().' has no association named '.$field);
1047 1047
         }
1048 1048
 
1049 1049
         return new AST\JoinAssociationPathExpression($identVariable, $field);
@@ -2465,7 +2465,7 @@  discard block
 block discarded – undo
2465 2465
         // Peek beyond the matching closing parenthesis ')'
2466 2466
         $peek = $this->peekBeyondClosingParenthesis();
2467 2467
 
2468
-        if (in_array($peek['value'], ["=",  "<", "<=", "<>", ">", ">=", "!="]) ||
2468
+        if (in_array($peek['value'], ["=", "<", "<=", "<>", ">", ">=", "!="]) ||
2469 2469
             in_array($peek['type'], [Lexer::T_NOT, Lexer::T_BETWEEN, Lexer::T_LIKE, Lexer::T_IN, Lexer::T_IS, Lexer::T_EXISTS]) ||
2470 2470
             $this->isMathOperator($peek)) {
2471 2471
             $condPrimary->simpleConditionalExpression = $this->SimpleConditionalExpression();
@@ -2570,7 +2570,7 @@  discard block
 block discarded – undo
2570 2570
             return $this->NullComparisonExpression();
2571 2571
         }
2572 2572
 
2573
-        if ($token['type'] === Lexer::T_IS  && $lookahead['type'] === Lexer::T_EMPTY) {
2573
+        if ($token['type'] === Lexer::T_IS && $lookahead['type'] === Lexer::T_EMPTY) {
2574 2574
             return $this->EmptyCollectionComparisonExpression();
2575 2575
         }
2576 2576
 
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Doctrine\ORM\Mapping;
6 6
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         ClassMetadataBuildingContext $metadataBuildingContext
91 91
     ) : ?ClassMetadata
92 92
     {
93
-        if (! $this->evm->hasListeners(Events::onClassMetadataNotFound)) {
93
+        if ( ! $this->evm->hasListeners(Events::onClassMetadataNotFound)) {
94 94
             return null;
95 95
         }
96 96
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
             }
166 166
         }
167 167
 
168
-        if (! $classMetadata->discriminatorMap && $classMetadata->inheritanceType !== InheritanceType::NONE && $classMetadata->isRootEntity()) {
168
+        if ( ! $classMetadata->discriminatorMap && $classMetadata->inheritanceType !== InheritanceType::NONE && $classMetadata->isRootEntity()) {
169 169
             $this->addDefaultDiscriminatorMap($classMetadata);
170 170
         }
171 171
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      */
192 192
     protected function completeRuntimeMetadata(ClassMetadata $class, ClassMetadata $parent = null) : void
193 193
     {
194
-        if (! $parent || ! $parent->isMappedSuperclass) {
194
+        if ( ! $parent || ! $parent->isMappedSuperclass) {
195 195
             return;
196 196
         }
197 197
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
                 continue;
210 210
             }
211 211
 
212
-            if (! ($property instanceof ToOneAssociationMetadata)) {
212
+            if ( ! ($property instanceof ToOneAssociationMetadata)) {
213 213
                 continue;
214 214
             }
215 215
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      */
234 234
     protected function validateRuntimeMetadata(ClassMetadata $class, ClassMetadata $parent = null) : void
235 235
     {
236
-        if (! $class->getReflectionClass()) {
236
+        if ( ! $class->getReflectionClass()) {
237 237
             // only validate if there is a reflection class instance
238 238
             return;
239 239
         }
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
         // verify inheritance
246 246
         if ( ! $class->isMappedSuperclass && $class->inheritanceType !== InheritanceType::NONE) {
247 247
             if ( ! $parent) {
248
-                if (! $class->discriminatorMap) {
248
+                if ( ! $class->discriminatorMap) {
249 249
                     throw MappingException::missingDiscriminatorMap($class->getClassName());
250 250
                 }
251 251
 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 
508 508
     private function completeFieldIdentifierGeneratorMapping(FieldMetadata $field)
509 509
     {
510
-        if (!$field->hasValueGenerator()) {
510
+        if ( ! $field->hasValueGenerator()) {
511 511
             return;
512 512
         }
513 513
 
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
                 break;
575 575
 
576 576
             default:
577
-                throw new ORMException("Unknown generator type: " . $generator->getType());
577
+                throw new ORMException("Unknown generator type: ".$generator->getType());
578 578
         }
579 579
     }
580 580
 
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
      */
600 600
     private function getTargetPlatform() : Platforms\AbstractPlatform
601 601
     {
602
-        if (!$this->targetPlatform) {
602
+        if ( ! $this->targetPlatform) {
603 603
             $this->targetPlatform = $this->em->getConnection()->getDatabasePlatform();
604 604
         }
605 605
 
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
         $generatedProperties = [];
618 618
 
619 619
         foreach ($class->getDeclaredPropertiesIterator() as $property) {
620
-            if (! ($property instanceof LocalColumnMetadata && $property->hasValueGenerator())) {
620
+            if ( ! ($property instanceof LocalColumnMetadata && $property->hasValueGenerator())) {
621 621
                 continue;
622 622
             }
623 623
 
Please login to merge, or discard this patch.