Passed
Pull Request — master (#7938)
by Šimon
15:10
created
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3644Test.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     {
157 157
         $this->addresses = $addresses;
158 158
 
159
-        $addresses->map(function ($address) {
159
+        $addresses->map(function($address) {
160 160
             $address->user = $this;
161 161
         });
162 162
     }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
     {
166 166
         $this->pets = $pets;
167 167
 
168
-        $pets->map(function ($pet) {
168
+        $pets->map(function($pet) {
169 169
             $pet->owner = $this;
170 170
         });
171 171
     }
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/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($associationMetadata->getCascade(), ['remove'])));
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.
tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 use function strtoupper;
37 37
 use function unserialize;
38 38
 
39
-require_once __DIR__ . '/../../Models/Global/GlobalNamespaceModel.php';
39
+require_once __DIR__.'/../../Models/Global/GlobalNamespaceModel.php';
40 40
 
41 41
 class ClassMetadataTest extends OrmTestCase
42 42
 {
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function testMapAssociationInGlobalNamespace() : void
167 167
     {
168
-        require_once __DIR__ . '/../../Models/Global/GlobalNamespaceModel.php';
168
+        require_once __DIR__.'/../../Models/Global/GlobalNamespaceModel.php';
169 169
 
170 170
         $cm = new ClassMetadata(DoctrineGlobalArticle::class, null);
171 171
         $cm->setTable(new Mapping\TableMetadata('doctrine_global_article'));
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
      */
266 266
     public function testSetDiscriminatorMapInGlobalNamespace() : void
267 267
     {
268
-        require_once __DIR__ . '/../../Models/Global/GlobalNamespaceModel.php';
268
+        require_once __DIR__.'/../../Models/Global/GlobalNamespaceModel.php';
269 269
 
270 270
         $cm = new ClassMetadata('DoctrineGlobalUser', null);
271 271
         $cm->setTable(new Mapping\TableMetadata('doctrine_global_user'));
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
      */
282 282
     public function testSetSubClassesInGlobalNamespace() : void
283 283
     {
284
-        require_once __DIR__ . '/../../Models/Global/GlobalNamespaceModel.php';
284
+        require_once __DIR__.'/../../Models/Global/GlobalNamespaceModel.php';
285 285
 
286 286
         $cm = new ClassMetadata('DoctrineGlobalUser', null);
287 287
         $cm->setTable(new Mapping\TableMetadata('doctrine_global_user'));
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
     public function testEmptyFieldNameThrowsException() : void
768 768
     {
769 769
         $this->expectException(MappingException::class);
770
-        $this->expectExceptionMessage("The field or association mapping misses the 'fieldName' attribute in entity '" . CMS\CmsUser::class . "'.");
770
+        $this->expectExceptionMessage("The field or association mapping misses the 'fieldName' attribute in entity '".CMS\CmsUser::class."'.");
771 771
 
772 772
         $cm = new ClassMetadata(CMS\CmsUser::class, null);
773 773
         $cm->setTable(new Mapping\TableMetadata('cms_users'));
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
         $cm->addLifecycleCallback('postLoad', 'notfound');
820 820
 
821 821
         $this->expectException(MappingException::class);
822
-        $this->expectExceptionMessage("Entity '" . CMS\CmsUser::class . "' has no public method 'notfound' to be registered as lifecycle callback.");
822
+        $this->expectExceptionMessage("Entity '".CMS\CmsUser::class."' has no public method 'notfound' to be registered as lifecycle callback.");
823 823
 
824 824
         $cm->validateLifecycleCallbacks(new RuntimeReflectionService());
825 825
     }
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
         $cm->addProperty($association);
842 842
 
843 843
         $this->expectException(MappingException::class);
844
-        $this->expectExceptionMessage("The target-entity 'UnknownClass' cannot be found in '" . CMS\CmsUser::class . "#address'.");
844
+        $this->expectExceptionMessage("The target-entity 'UnknownClass' cannot be found in '".CMS\CmsUser::class."#address'.");
845 845
 
846 846
         $cm->validateAssociations();
847 847
     }
@@ -1089,6 +1089,6 @@  discard block
 block discarded – undo
1089 1089
      */
1090 1090
     public function propertyToColumnName(string $propertyName, ?string $className = null) : string
1091 1091
     {
1092
-        return strtolower($this->classToTableName($className)) . '_' . $propertyName;
1092
+        return strtolower($this->classToTableName($className)).'_'.$propertyName;
1093 1093
     }
1094 1094
 }
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/ClassMetadata.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
             $this->setCache(clone $parent->cache);
221 221
         }
222 222
 
223
-        if (! empty($parent->lifecycleCallbacks)) {
223
+        if ( ! empty($parent->lifecycleCallbacks)) {
224 224
             $this->lifecycleCallbacks = $parent->lifecycleCallbacks;
225 225
         }
226 226
 
227
-        if (! empty($parent->entityListeners)) {
227
+        if ( ! empty($parent->entityListeners)) {
228 228
             $this->entityListeners = $parent->entityListeners;
229 229
         }
230 230
     }
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
      */
292 292
     public function __toString()
293 293
     {
294
-        return self::class . '@' . spl_object_id($this);
294
+        return self::class.'@'.spl_object_id($this);
295 295
     }
296 296
 
297 297
     /**
@@ -387,11 +387,11 @@  discard block
 block discarded – undo
387 387
      */
388 388
     public function isIdentifier(string $fieldName) : bool
389 389
     {
390
-        if (! $this->identifier) {
390
+        if ( ! $this->identifier) {
391 391
             return false;
392 392
         }
393 393
 
394
-        if (! $this->isIdentifierComposite()) {
394
+        if ( ! $this->isIdentifierComposite()) {
395 395
             return $fieldName === $this->identifier[0];
396 396
         }
397 397
 
@@ -415,11 +415,11 @@  discard block
 block discarded – undo
415 415
         }
416 416
 
417 417
         // Verify & complete identifier mapping
418
-        if (! $this->identifier) {
418
+        if ( ! $this->identifier) {
419 419
             throw MappingException::identifierRequired($this->className);
420 420
         }
421 421
 
422
-        $explicitlyGeneratedProperties = array_filter($this->properties, static function (Property $property) : bool {
422
+        $explicitlyGeneratedProperties = array_filter($this->properties, static function(Property $property) : bool {
423 423
             return $property instanceof FieldMetadata
424 424
                 && $property->isPrimaryKey()
425 425
                 && $property->hasValueGenerator();
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
         foreach ($this->lifecycleCallbacks as $callbacks) {
441 441
             /** @var array $callbacks */
442 442
             foreach ($callbacks as $callbackFuncName) {
443
-                if (! $reflectionService->hasPublicMethod($this->className, $callbackFuncName)) {
443
+                if ( ! $reflectionService->hasPublicMethod($this->className, $callbackFuncName)) {
444 444
                     throw MappingException::lifecycleCallbackMethodNotFound($this->className, $callbackFuncName);
445 445
                 }
446 446
             }
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
             throw MappingException::singleIdNotAllowedOnCompositePrimaryKey($this->className);
470 470
         }
471 471
 
472
-        if (! isset($this->identifier[0])) {
472
+        if ( ! isset($this->identifier[0])) {
473 473
             throw MappingException::noIdDefined($this->className);
474 474
         }
475 475
 
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
             // Association defined as Id field
529 529
             $targetClass = $em->getClassMetadata($property->getTargetEntity());
530 530
 
531
-            if (! $property->isOwningSide()) {
531
+            if ( ! $property->isOwningSide()) {
532 532
                 $property    = $targetClass->getProperty($property->getMappedBy());
533 533
                 $targetClass = $em->getClassMetadata($property->getTargetEntity());
534 534
             }
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
                 $columnName           = $joinColumn->getColumnName();
543 543
                 $referencedColumnName = $joinColumn->getReferencedColumnName();
544 544
 
545
-                if (! $joinColumn->getType()) {
545
+                if ( ! $joinColumn->getType()) {
546 546
                     $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $em));
547 547
                 }
548 548
 
@@ -576,10 +576,10 @@  discard block
 block discarded – undo
576 576
     {
577 577
         $schema = $this->getSchemaName() === null
578 578
             ? ''
579
-            : $this->getSchemaName() . '_';
579
+            : $this->getSchemaName().'_';
580 580
 
581 581
         // replace dots with underscores because PostgreSQL creates temporary tables in a special schema
582
-        return $schema . $this->getTableName() . '_id_tmp';
582
+        return $schema.$this->getTableName().'_id_tmp';
583 583
     }
584 584
 
585 585
     /**
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
      */
614 614
     public function setInheritanceType($type) : void
615 615
     {
616
-        if (! $this->isInheritanceType($type)) {
616
+        if ( ! $this->isInheritanceType($type)) {
617 617
             throw MappingException::invalidInheritanceType($this->className, $type);
618 618
         }
619 619
 
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
     {
632 632
         $fieldName = $property->getName();
633 633
 
634
-        if (! isset($this->properties[$fieldName])) {
634
+        if ( ! isset($this->properties[$fieldName])) {
635 635
             throw MappingException::invalidOverrideFieldName($this->className, $fieldName);
636 636
         }
637 637
 
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
         $inheritedProperty = $declaringClass->isMappedSuperclass ? clone $property : $property;
826 826
 
827 827
         if ($inheritedProperty instanceof FieldMetadata) {
828
-            if (! $declaringClass->isMappedSuperclass) {
828
+            if ( ! $declaringClass->isMappedSuperclass) {
829 829
                 $inheritedProperty->setTableName($property->getTableName());
830 830
             }
831 831
 
@@ -918,11 +918,11 @@  discard block
 block discarded – undo
918 918
             'method' => $methodName,
919 919
         ];
920 920
 
921
-        if (! class_exists($class)) {
921
+        if ( ! class_exists($class)) {
922 922
             throw MappingException::entityListenerClassNotFound($class, $this->className);
923 923
         }
924 924
 
925
-        if (! method_exists($class, $methodName)) {
925
+        if ( ! method_exists($class, $methodName)) {
926 926
             throw MappingException::entityListenerMethodNotFound($class, $methodName, $this->className);
927 927
         }
928 928
 
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
             return;
991 991
         }
992 992
 
993
-        if (! (class_exists($className) || interface_exists($className))) {
993
+        if ( ! (class_exists($className) || interface_exists($className))) {
994 994
             throw MappingException::invalidClassInDiscriminatorMap($className, $this->className);
995 995
         }
996 996
 
Please login to merge, or discard this patch.