Failed Conditions
Pull Request — master (#7799)
by Guilherme
10:54
created
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
             return $this->classNames;
211 211
         }
212 212
 
213
-        if (! $this->paths) {
213
+        if ( ! $this->paths) {
214 214
             throw Mapping\MappingException::pathRequired();
215 215
         }
216 216
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
         $includedFiles = [];
219 219
 
220 220
         foreach ($this->paths as $path) {
221
-            if (! is_dir($path)) {
221
+            if ( ! is_dir($path)) {
222 222
                 throw Mapping\MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path);
223 223
             }
224 224
 
@@ -227,14 +227,14 @@  discard block
 block discarded – undo
227 227
                     new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS),
228 228
                     RecursiveIteratorIterator::LEAVES_ONLY
229 229
                 ),
230
-                '/^.+' . preg_quote($this->fileExtension) . '$/i',
230
+                '/^.+'.preg_quote($this->fileExtension).'$/i',
231 231
                 RecursiveRegexIterator::GET_MATCH
232 232
             );
233 233
 
234 234
             foreach ($iterator as $file) {
235 235
                 $sourceFile = $file[0];
236 236
 
237
-                if (! preg_match('(^phar:)i', $sourceFile)) {
237
+                if ( ! preg_match('(^phar:)i', $sourceFile)) {
238 238
                     $sourceFile = realpath($sourceFile);
239 239
                 }
240 240
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
         if ($parent && $parent->inheritanceType === Mapping\InheritanceType::SINGLE_TABLE) {
413 413
             // Handle the case where a middle mapped super class inherits from a single table inheritance tree.
414 414
             do {
415
-                if (! $parent->isMappedSuperclass) {
415
+                if ( ! $parent->isMappedSuperclass) {
416 416
                     $metadata->setTable($parent->table);
417 417
 
418 418
                     break;
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
             ];
705 705
 
706 706
             foreach ($entityListenersAnnot->value as $listenerClassName) {
707
-                if (! class_exists($listenerClassName)) {
707
+                if ( ! class_exists($listenerClassName)) {
708 708
                     throw Mapping\MappingException::entityListenerClassNotFound(
709 709
                         $listenerClassName,
710 710
                         $metadata->getClassName()
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
                 $fieldName = $associationOverride->name;
747 747
                 $property  = $metadata->getProperty($fieldName);
748 748
 
749
-                if (! $property) {
749
+                if ( ! $property) {
750 750
                     throw Mapping\MappingException::invalidOverrideFieldName($metadata->getClassName(), $fieldName);
751 751
                 }
752 752
 
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
                 // Check for fetch
794 794
                 if ($associationOverride->fetch) {
795 795
                     $override->setFetchMode(
796
-                        constant(Mapping\FetchMode::class . '::' . $associationOverride->fetch)
796
+                        constant(Mapping\FetchMode::class.'::'.$associationOverride->fetch)
797 797
                     );
798 798
                 }
799 799
 
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
     {
865 865
         $fetchModeConstant = sprintf('%s::%s', Mapping\FetchMode::class, $fetchMode);
866 866
 
867
-        if (! defined($fetchModeConstant)) {
867
+        if ( ! defined($fetchModeConstant)) {
868 868
             throw Mapping\MappingException::invalidFetchMode($className, $fetchMode);
869 869
         }
870 870
 
@@ -879,7 +879,7 @@  discard block
 block discarded – undo
879 879
         $classAnnotations = $this->reader->getClassAnnotations($reflectionClass);
880 880
 
881 881
         foreach ($classAnnotations as $key => $annot) {
882
-            if (! is_numeric($key)) {
882
+            if ( ! is_numeric($key)) {
883 883
                 continue;
884 884
             }
885 885
 
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
         $propertyAnnotations = $this->reader->getPropertyAnnotations($reflectionProperty);
898 898
 
899 899
         foreach ($propertyAnnotations as $key => $annot) {
900
-            if (! is_numeric($key)) {
900
+            if ( ! is_numeric($key)) {
901 901
                 continue;
902 902
             }
903 903
 
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
         $methodAnnotations = $this->reader->getMethodAnnotations($reflectionMethod);
916 916
 
917 917
         foreach ($methodAnnotations as $key => $annot) {
918
-            if (! is_numeric($key)) {
918
+            if ( ! is_numeric($key)) {
919 919
                 continue;
920 920
             }
921 921
 
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         if ($parent && $parent->inheritanceType === Mapping\InheritanceType::SINGLE_TABLE) {
80 80
             // Handle the case where a middle mapped super class inherits from a single table inheritance tree.
81 81
             do {
82
-                if (! $parent->isMappedSuperclass) {
82
+                if ( ! $parent->isMappedSuperclass) {
83 83
                     $metadata->setTable($parent->table);
84 84
 
85 85
                     break;
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
                 }
461 461
 
462 462
                 // Check for owning side to consider join column
463
-                if (! $association->isOwningSide()) {
463
+                if ( ! $association->isOwningSide()) {
464 464
                     $metadata->addProperty($association);
465 465
 
466 466
                     continue;
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
                 $fieldName = (string) $overrideElement['name'];
529 529
                 $property  = $metadata->getProperty($fieldName);
530 530
 
531
-                if (! $property) {
531
+                if ( ! $property) {
532 532
                     throw Mapping\MappingException::invalidOverrideFieldName($metadata->getClassName(), $fieldName);
533 533
                 }
534 534
 
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
                 // Check for fetch
578 578
                 if (isset($overrideElement['fetch'])) {
579 579
                     $override->setFetchMode(
580
-                        constant('Doctrine\ORM\Mapping\FetchMode::' . (string) $overrideElement['fetch'])
580
+                        constant('Doctrine\ORM\Mapping\FetchMode::'.(string) $overrideElement['fetch'])
581 581
                     );
582 582
                 }
583 583
 
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
         // Evaluate <lifecycle-callbacks...>
589 589
         if (isset($xmlRoot->{'lifecycle-callbacks'})) {
590 590
             foreach ($xmlRoot->{'lifecycle-callbacks'}->{'lifecycle-callback'} as $lifecycleCallback) {
591
-                $eventName  = constant(Events::class . '::' . (string) $lifecycleCallback['type']);
591
+                $eventName  = constant(Events::class.'::'.(string) $lifecycleCallback['type']);
592 592
                 $methodName = (string) $lifecycleCallback['method'];
593 593
 
594 594
                 $metadata->addLifecycleCallback($eventName, $methodName);
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
             foreach ($xmlRoot->{'entity-listeners'}->{'entity-listener'} as $listenerElement) {
601 601
                 $listenerClassName = (string) $listenerElement['class'];
602 602
 
603
-                if (! class_exists($listenerClassName)) {
603
+                if ( ! class_exists($listenerClassName)) {
604 604
                     throw Mapping\MappingException::entityListenerClassNotFound(
605 605
                         $listenerClassName,
606 606
                         $metadata->getClassName()
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/Builder/OneToOneAssociationMetadataBuilder.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
             $associationMetadata->setCascade(array_unique(array_merge(['remove'], $associationMetadata->getCascade())));
52 52
         }
53 53
 
54
-        if (! empty($this->oneToOneAnnotation->mappedBy)) {
54
+        if ( ! empty($this->oneToOneAnnotation->mappedBy)) {
55 55
             $associationMetadata->setMappedBy($this->oneToOneAnnotation->mappedBy);
56 56
             $associationMetadata->setOwningSide(false);
57 57
         }
58 58
 
59
-        if (! empty($this->oneToOneAnnotation->inversedBy)) {
59
+        if ( ! empty($this->oneToOneAnnotation->inversedBy)) {
60 60
             $associationMetadata->setInversedBy($this->oneToOneAnnotation->inversedBy);
61 61
             $associationMetadata->setOwningSide(true);
62 62
         }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         $this->buildPrimaryKey($associationMetadata);
66 66
 
67 67
         // Check for owning side to consider join column
68
-        if (! $associationMetadata->isOwningSide()) {
68
+        if ( ! $associationMetadata->isOwningSide()) {
69 69
             return $associationMetadata;
70 70
         }
71 71
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         if (count($joinColumns) === 1) {
90 90
             $joinColumn = reset($joinColumns);
91 91
 
92
-            if (! $associationMetadata->isPrimaryKey()) {
92
+            if ( ! $associationMetadata->isPrimaryKey()) {
93 93
                 $joinColumn->setUnique(true);
94 94
             }
95 95
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
         $tableMetadata = $this->componentMetadata->table;
100 100
 
101
-        if (! $tableMetadata) {
101
+        if ( ! $tableMetadata) {
102 102
             $exception = 'ClassMetadata::setTable() has to be called before defining a one to one relationship.';
103 103
 
104 104
             throw new RuntimeException($exception);
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/Builder/ToOneAssociationMetadataBuilder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
                 );
84 84
             }
85 85
 
86
-            if (! $associationMetadata->isOwningSide()) {
86
+            if ( ! $associationMetadata->isOwningSide()) {
87 87
                 throw Mapping\MappingException::illegalInverseIdentifierAssociation(
88 88
                     $this->componentMetadata->getClassName(),
89 89
                     $this->fieldName
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             // @todo guilhermeblanco The below block of code modifies component metadata properties, and it should be moved
101 101
             //                       to the component metadata builder instead of here.
102 102
 
103
-            if (! in_array($this->fieldName, $this->componentMetadata->identifier, true)) {
103
+            if ( ! in_array($this->fieldName, $this->componentMetadata->identifier, true)) {
104 104
                 $this->componentMetadata->identifier[] = $this->fieldName;
105 105
             }
106 106
 
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/Builder/OneToManyAssociationMetadataBuilder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
         $associationMetadata->setOwningSide(false);
47 47
         $associationMetadata->setMappedBy($this->oneToManyAnnotation->mappedBy);
48 48
 
49
-        if (! empty($this->oneToManyAnnotation->indexBy)) {
49
+        if ( ! empty($this->oneToManyAnnotation->indexBy)) {
50 50
             $associationMetadata->setIndexedBy($this->oneToManyAnnotation->indexBy);
51 51
         }
52 52
 
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/Builder/ManyToManyAssociationMetadataBuilder.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
         $associationMetadata->setFetchMode($this->getFetchMode($this->manyToManyAnnotation->fetch));
87 87
         $associationMetadata->setOwningSide(true);
88 88
 
89
-        if (! empty($this->manyToManyAnnotation->mappedBy)) {
89
+        if ( ! empty($this->manyToManyAnnotation->mappedBy)) {
90 90
             $associationMetadata->setMappedBy($this->manyToManyAnnotation->mappedBy);
91 91
             $associationMetadata->setOwningSide(false);
92 92
         }
93 93
 
94
-        if (! empty($this->manyToManyAnnotation->inversedBy)) {
94
+        if ( ! empty($this->manyToManyAnnotation->inversedBy)) {
95 95
             $associationMetadata->setInversedBy($this->manyToManyAnnotation->inversedBy);
96 96
         }
97 97
 
98
-        if (! empty($this->manyToManyAnnotation->indexBy)) {
98
+        if ( ! empty($this->manyToManyAnnotation->indexBy)) {
99 99
             $associationMetadata->setIndexedBy($this->manyToManyAnnotation->indexBy);
100 100
         }
101 101
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         $this->buildCache($associationMetadata);
114 114
 
115 115
         // Check for owning side to consider join column
116
-        if (! $associationMetadata->isOwningSide()) {
116
+        if ( ! $associationMetadata->isOwningSide()) {
117 117
             return $associationMetadata;
118 118
         }
119 119
 
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/Builder/AssociationMetadataBuilder.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
     protected function getTargetEntity(string $targetEntity) : string
91 91
     {
92 92
         // Validate if target entity is defined
93
-        if (! $targetEntity) {
93
+        if ( ! $targetEntity) {
94 94
             throw Mapping\MappingException::missingTargetEntity($this->fieldName);
95 95
         }
96 96
 
97 97
         // Validate that target entity exists
98
-        if (! (class_exists($targetEntity) || interface_exists($targetEntity))) {
98
+        if ( ! (class_exists($targetEntity) || interface_exists($targetEntity))) {
99 99
             throw Mapping\MappingException::invalidTargetEntityClass(
100 100
                 $targetEntity,
101 101
                 $this->componentMetadata->getClassName(),
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     {
151 151
         $fetchModeConstant = sprintf('%s::%s', Mapping\FetchMode::class, $fetchMode);
152 152
 
153
-        if (! defined($fetchModeConstant)) {
153
+        if ( ! defined($fetchModeConstant)) {
154 154
             throw Mapping\MappingException::invalidFetchMode($this->componentMetadata->getClassName(), $fetchMode);
155 155
         }
156 156
 
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/Builder/ManyToOneAssociationMetadataBuilder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
         $associationMetadata->setFetchMode($this->getFetchMode($this->manyToOneAnnotation->fetch));
42 42
         $associationMetadata->setOwningSide(true);
43 43
 
44
-        if (! empty($this->manyToOneAnnotation->inversedBy)) {
44
+        if ( ! empty($this->manyToOneAnnotation->inversedBy)) {
45 45
             $associationMetadata->setInversedBy($this->manyToOneAnnotation->inversedBy);
46 46
         }
47 47
 
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/ClassMetadata.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
             $this->setCache(clone $parent->cache);
230 230
         }
231 231
 
232
-        if (! empty($parent->lifecycleCallbacks)) {
232
+        if ( ! empty($parent->lifecycleCallbacks)) {
233 233
             $this->lifecycleCallbacks = $parent->lifecycleCallbacks;
234 234
         }
235 235
 
236
-        if (! empty($parent->entityListeners)) {
236
+        if ( ! empty($parent->entityListeners)) {
237 237
             $this->entityListeners = $parent->entityListeners;
238 238
         }
239 239
     }
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
      */
301 301
     public function __toString()
302 302
     {
303
-        return self::class . '@' . spl_object_id($this);
303
+        return self::class.'@'.spl_object_id($this);
304 304
     }
305 305
 
306 306
     /**
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
         // Restore ReflectionClass and properties
388 388
         $this->reflectionClass = $reflectionService->getClass($this->className);
389 389
 
390
-        if (! $this->reflectionClass) {
390
+        if ( ! $this->reflectionClass) {
391 391
             return;
392 392
         }
393 393
 
@@ -416,11 +416,11 @@  discard block
 block discarded – undo
416 416
      */
417 417
     public function isIdentifier(string $fieldName) : bool
418 418
     {
419
-        if (! $this->identifier) {
419
+        if ( ! $this->identifier) {
420 420
             return false;
421 421
         }
422 422
 
423
-        if (! $this->isIdentifierComposite()) {
423
+        if ( ! $this->isIdentifierComposite()) {
424 424
             return $fieldName === $this->identifier[0];
425 425
         }
426 426
 
@@ -444,11 +444,11 @@  discard block
 block discarded – undo
444 444
         }
445 445
 
446 446
         // Verify & complete identifier mapping
447
-        if (! $this->identifier) {
447
+        if ( ! $this->identifier) {
448 448
             throw MappingException::identifierRequired($this->className);
449 449
         }
450 450
 
451
-        $explicitlyGeneratedProperties = array_filter($this->properties, static function (Property $property) : bool {
451
+        $explicitlyGeneratedProperties = array_filter($this->properties, static function(Property $property) : bool {
452 452
             return $property instanceof FieldMetadata
453 453
                 && $property->isPrimaryKey()
454 454
                 && $property->hasValueGenerator();
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
         foreach ($this->lifecycleCallbacks as $callbacks) {
470 470
             /** @var array $callbacks */
471 471
             foreach ($callbacks as $callbackFuncName) {
472
-                if (! $reflectionService->hasPublicMethod($this->className, $callbackFuncName)) {
472
+                if ( ! $reflectionService->hasPublicMethod($this->className, $callbackFuncName)) {
473 473
                     throw MappingException::lifecycleCallbackMethodNotFound($this->className, $callbackFuncName);
474 474
                 }
475 475
             }
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
             throw MappingException::singleIdNotAllowedOnCompositePrimaryKey($this->className);
499 499
         }
500 500
 
501
-        if (! isset($this->identifier[0])) {
501
+        if ( ! isset($this->identifier[0])) {
502 502
             throw MappingException::noIdDefined($this->className);
503 503
         }
504 504
 
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
             // Association defined as Id field
558 558
             $targetClass = $em->getClassMetadata($property->getTargetEntity());
559 559
 
560
-            if (! $property->isOwningSide()) {
560
+            if ( ! $property->isOwningSide()) {
561 561
                 $property    = $targetClass->getProperty($property->getMappedBy());
562 562
                 $targetClass = $em->getClassMetadata($property->getTargetEntity());
563 563
             }
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
                 $columnName           = $joinColumn->getColumnName();
572 572
                 $referencedColumnName = $joinColumn->getReferencedColumnName();
573 573
 
574
-                if (! $joinColumn->getType()) {
574
+                if ( ! $joinColumn->getType()) {
575 575
                     $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $em));
576 576
                 }
577 577
 
@@ -605,10 +605,10 @@  discard block
 block discarded – undo
605 605
     {
606 606
         $schema = $this->getSchemaName() === null
607 607
             ? ''
608
-            : $this->getSchemaName() . '_';
608
+            : $this->getSchemaName().'_';
609 609
 
610 610
         // replace dots with underscores because PostgreSQL creates temporary tables in a special schema
611
-        return $schema . $this->getTableName() . '_id_tmp';
611
+        return $schema.$this->getTableName().'_id_tmp';
612 612
     }
613 613
 
614 614
     /**
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
      */
643 643
     public function setInheritanceType($type) : void
644 644
     {
645
-        if (! $this->isInheritanceType($type)) {
645
+        if ( ! $this->isInheritanceType($type)) {
646 646
             throw MappingException::invalidInheritanceType($this->className, $type);
647 647
         }
648 648
 
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
     {
661 661
         $fieldName = $property->getName();
662 662
 
663
-        if (! isset($this->properties[$fieldName])) {
663
+        if ( ! isset($this->properties[$fieldName])) {
664 664
             throw MappingException::invalidOverrideFieldName($this->className, $fieldName);
665 665
         }
666 666
 
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
         $inheritedProperty = $declaringClass->isMappedSuperclass ? clone $property : $property;
855 855
 
856 856
         if ($inheritedProperty instanceof FieldMetadata) {
857
-            if (! $declaringClass->isMappedSuperclass) {
857
+            if ( ! $declaringClass->isMappedSuperclass) {
858 858
                 $inheritedProperty->setTableName($property->getTableName());
859 859
             }
860 860
 
@@ -947,11 +947,11 @@  discard block
 block discarded – undo
947 947
             'method' => $methodName,
948 948
         ];
949 949
 
950
-        if (! class_exists($class)) {
950
+        if ( ! class_exists($class)) {
951 951
             throw MappingException::entityListenerClassNotFound($class, $this->className);
952 952
         }
953 953
 
954
-        if (! method_exists($class, $methodName)) {
954
+        if ( ! method_exists($class, $methodName)) {
955 955
             throw MappingException::entityListenerMethodNotFound($class, $methodName, $this->className);
956 956
         }
957 957
 
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
             return;
1020 1020
         }
1021 1021
 
1022
-        if (! (class_exists($className) || interface_exists($className))) {
1022
+        if ( ! (class_exists($className) || interface_exists($className))) {
1023 1023
             throw MappingException::invalidClassInDiscriminatorMap($className, $this->className);
1024 1024
         }
1025 1025
 
Please login to merge, or discard this patch.