Passed
Push — master ( 89e39b...ec508a )
by Marco
11:02
created
lib/Doctrine/ORM/Mapping/ClassMetadata.php 1 patch
Spacing   +41 added lines, -41 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
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
      */
264 264
     public function __toString()
265 265
     {
266
-        return __CLASS__ . '@' . spl_object_id($this);
266
+        return __CLASS__.'@'.spl_object_id($this);
267 267
     }
268 268
 
269 269
     /**
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
         // Restore ReflectionClass and properties
351 351
         $this->reflectionClass = $reflectionService->getClass($this->className);
352 352
 
353
-        if (! $this->reflectionClass) {
353
+        if ( ! $this->reflectionClass) {
354 354
             return;
355 355
         }
356 356
 
@@ -374,11 +374,11 @@  discard block
 block discarded – undo
374 374
         }
375 375
 
376 376
         // Verify & complete identifier mapping
377
-        if (! $this->identifier) {
377
+        if ( ! $this->identifier) {
378 378
             throw MappingException::identifierRequired($this->className);
379 379
         }
380 380
 
381
-        $explicitlyGeneratedProperties = array_filter($this->declaredProperties, function (Property $property) : bool {
381
+        $explicitlyGeneratedProperties = array_filter($this->declaredProperties, function(Property $property) : bool {
382 382
             return $property instanceof FieldMetadata
383 383
                 && $property->isPrimaryKey()
384 384
                 && $property->hasValueGenerator();
@@ -397,14 +397,14 @@  discard block
 block discarded – undo
397 397
     public function validateAssociations() : void
398 398
     {
399 399
         array_map(
400
-            function (Property $property) {
401
-                if (! ($property instanceof AssociationMetadata)) {
400
+            function(Property $property) {
401
+                if ( ! ($property instanceof AssociationMetadata)) {
402 402
                     return;
403 403
                 }
404 404
 
405 405
                 $targetEntity = $property->getTargetEntity();
406 406
 
407
-                if (! class_exists($targetEntity)) {
407
+                if ( ! class_exists($targetEntity)) {
408 408
                     throw MappingException::invalidTargetEntityClass($targetEntity, $this->className, $property->getName());
409 409
                 }
410 410
             },
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
         foreach ($this->lifecycleCallbacks as $callbacks) {
423 423
             /** @var array $callbacks */
424 424
             foreach ($callbacks as $callbackFuncName) {
425
-                if (! $reflectionService->hasPublicMethod($this->className, $callbackFuncName)) {
425
+                if ( ! $reflectionService->hasPublicMethod($this->className, $callbackFuncName)) {
426 426
                     throw MappingException::lifecycleCallbackMethodNotFound($this->className, $callbackFuncName);
427 427
                 }
428 428
             }
@@ -446,11 +446,11 @@  discard block
 block discarded – undo
446 446
      */
447 447
     public function isIdentifier(string $fieldName) : bool
448 448
     {
449
-        if (! $this->identifier) {
449
+        if ( ! $this->identifier) {
450 450
             return false;
451 451
         }
452 452
 
453
-        if (! $this->isIdentifierComposite()) {
453
+        if ( ! $this->isIdentifierComposite()) {
454 454
             return $fieldName === $this->identifier[0];
455 455
         }
456 456
 
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
             $property->setColumnName($columnName);
479 479
         }
480 480
 
481
-        if (! $this->isMappedSuperclass) {
481
+        if ( ! $this->isMappedSuperclass) {
482 482
             $property->setTableName($this->getTableName());
483 483
         }
484 484
 
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
                 throw MappingException::sqlConversionNotAllowedForPrimaryKeyProperties($this->className, $property);
499 499
             }
500 500
 
501
-            if (! in_array($fieldName, $this->identifier, true)) {
501
+            if ( ! in_array($fieldName, $this->identifier, true)) {
502 502
                 $this->identifier[] = $fieldName;
503 503
             }
504 504
         }
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
         $fieldName    = $property->getName();
549 549
         $targetEntity = $property->getTargetEntity();
550 550
 
551
-        if (! $targetEntity) {
551
+        if ( ! $targetEntity) {
552 552
             throw MappingException::missingTargetEntity($fieldName);
553 553
         }
554 554
 
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
                 throw MappingException::illegalOrphanRemovalOnIdentifierAssociation($this->className, $fieldName);
562 562
             }
563 563
 
564
-            if (! in_array($property->getName(), $this->identifier, true)) {
564
+            if ( ! in_array($property->getName(), $this->identifier, true)) {
565 565
                 if ($property instanceof ToOneAssociationMetadata && count($property->getJoinColumns()) >= 2) {
566 566
                     throw MappingException::cannotMapCompositePrimaryKeyEntitiesAsForeignId(
567 567
                         $property->getTargetEntity(),
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
                 /** @var JoinColumnMetadata $joinColumn */
624 624
                 if ($property instanceof OneToOneAssociationMetadata && $this->inheritanceType !== InheritanceType::SINGLE_TABLE) {
625 625
                     if (count($property->getJoinColumns()) === 1) {
626
-                        if (! $property->isPrimaryKey()) {
626
+                        if ( ! $property->isPrimaryKey()) {
627 627
                             $joinColumn->setUnique(true);
628 628
                         }
629 629
                     } else {
@@ -631,13 +631,13 @@  discard block
 block discarded – undo
631 631
                     }
632 632
                 }
633 633
 
634
-                $joinColumn->setTableName(! $this->isMappedSuperclass ? $this->getTableName() : null);
634
+                $joinColumn->setTableName( ! $this->isMappedSuperclass ? $this->getTableName() : null);
635 635
 
636
-                if (! $joinColumn->getColumnName()) {
636
+                if ( ! $joinColumn->getColumnName()) {
637 637
                     $joinColumn->setColumnName($this->namingStrategy->joinColumnName($fieldName, $this->className));
638 638
                 }
639 639
 
640
-                if (! $joinColumn->getReferencedColumnName()) {
640
+                if ( ! $joinColumn->getReferencedColumnName()) {
641 641
                     $joinColumn->setReferencedColumnName($this->namingStrategy->referenceColumnName());
642 642
                 }
643 643
 
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
             }
646 646
 
647 647
             if ($uniqueConstraintColumns) {
648
-                if (! $this->table) {
648
+                if ( ! $this->table) {
649 649
                     throw new \RuntimeException(
650 650
                         'ClassMetadata::setTable() has to be called before defining a one to one relationship.'
651 651
                     );
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
         if ($property->isOrphanRemoval()) {
666 666
             $cascades = $property->getCascade();
667 667
 
668
-            if (! in_array('remove', $cascades, true)) {
668
+            if ( ! in_array('remove', $cascades, true)) {
669 669
                 $cascades[] = 'remove';
670 670
 
671 671
                 $property->setCascade($cascades);
@@ -728,14 +728,14 @@  discard block
 block discarded – undo
728 728
     protected function validateAndCompleteOneToManyMapping(OneToManyAssociationMetadata $property)
729 729
     {
730 730
         // OneToMany MUST have mappedBy
731
-        if (! $property->getMappedBy()) {
731
+        if ( ! $property->getMappedBy()) {
732 732
             throw MappingException::oneToManyRequiresMappedBy($property->getName());
733 733
         }
734 734
 
735 735
         if ($property->isOrphanRemoval()) {
736 736
             $cascades = $property->getCascade();
737 737
 
738
-            if (! in_array('remove', $cascades, true)) {
738
+            if ( ! in_array('remove', $cascades, true)) {
739 739
                 $cascades[] = 'remove';
740 740
 
741 741
                 $property->setCascade($cascades);
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
 
759 759
             $property->setJoinTable($joinTable);
760 760
 
761
-            if (! $joinTable->getName()) {
761
+            if ( ! $joinTable->getName()) {
762 762
                 $joinTableName = $this->namingStrategy->joinTableName(
763 763
                     $property->getSourceEntity(),
764 764
                     $property->getTargetEntity(),
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 
771 771
             $selfReferencingEntityWithoutJoinColumns = $property->getSourceEntity() === $property->getTargetEntity() && ! $joinTable->hasColumns();
772 772
 
773
-            if (! $joinTable->getJoinColumns()) {
773
+            if ( ! $joinTable->getJoinColumns()) {
774 774
                 $referencedColumnName = $this->namingStrategy->referenceColumnName();
775 775
                 $sourceReferenceName  = $selfReferencingEntityWithoutJoinColumns ? 'source' : $referencedColumnName;
776 776
                 $columnName           = $this->namingStrategy->joinKeyColumnName($property->getSourceEntity(), $sourceReferenceName);
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
                 $joinTable->addJoinColumn($joinColumn);
784 784
             }
785 785
 
786
-            if (! $joinTable->getInverseJoinColumns()) {
786
+            if ( ! $joinTable->getInverseJoinColumns()) {
787 787
                 $referencedColumnName = $this->namingStrategy->referenceColumnName();
788 788
                 $targetReferenceName  = $selfReferencingEntityWithoutJoinColumns ? 'target' : $referencedColumnName;
789 789
                 $columnName           = $this->namingStrategy->joinKeyColumnName($property->getTargetEntity(), $targetReferenceName);
@@ -798,13 +798,13 @@  discard block
 block discarded – undo
798 798
 
799 799
             foreach ($joinTable->getJoinColumns() as $joinColumn) {
800 800
                 /** @var JoinColumnMetadata $joinColumn */
801
-                if (! $joinColumn->getReferencedColumnName()) {
801
+                if ( ! $joinColumn->getReferencedColumnName()) {
802 802
                     $joinColumn->setReferencedColumnName($this->namingStrategy->referenceColumnName());
803 803
                 }
804 804
 
805 805
                 $referencedColumnName = $joinColumn->getReferencedColumnName();
806 806
 
807
-                if (! $joinColumn->getColumnName()) {
807
+                if ( ! $joinColumn->getColumnName()) {
808 808
                     $columnName = $this->namingStrategy->joinKeyColumnName(
809 809
                         $property->getSourceEntity(),
810 810
                         $referencedColumnName
@@ -816,13 +816,13 @@  discard block
 block discarded – undo
816 816
 
817 817
             foreach ($joinTable->getInverseJoinColumns() as $inverseJoinColumn) {
818 818
                 /** @var JoinColumnMetadata $inverseJoinColumn */
819
-                if (! $inverseJoinColumn->getReferencedColumnName()) {
819
+                if ( ! $inverseJoinColumn->getReferencedColumnName()) {
820 820
                     $inverseJoinColumn->setReferencedColumnName($this->namingStrategy->referenceColumnName());
821 821
                 }
822 822
 
823 823
                 $referencedColumnName = $inverseJoinColumn->getReferencedColumnName();
824 824
 
825
-                if (! $inverseJoinColumn->getColumnName()) {
825
+                if ( ! $inverseJoinColumn->getColumnName()) {
826 826
                     $columnName = $this->namingStrategy->joinKeyColumnName(
827 827
                         $property->getTargetEntity(),
828 828
                         $referencedColumnName
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
             throw MappingException::singleIdNotAllowedOnCompositePrimaryKey($this->className);
857 857
         }
858 858
 
859
-        if (! isset($this->identifier[0])) {
859
+        if ( ! isset($this->identifier[0])) {
860 860
             throw MappingException::noIdDefined($this->className);
861 861
         }
862 862
 
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
             // Association defined as Id field
916 916
             $targetClass = $em->getClassMetadata($property->getTargetEntity());
917 917
 
918
-            if (! $property->isOwningSide()) {
918
+            if ( ! $property->isOwningSide()) {
919 919
                 $property    = $targetClass->getProperty($property->getMappedBy());
920 920
                 $targetClass = $em->getClassMetadata($property->getTargetEntity());
921 921
             }
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
                 $columnName           = $joinColumn->getColumnName();
931 931
                 $referencedColumnName = $joinColumn->getReferencedColumnName();
932 932
 
933
-                if (! $joinColumn->getType()) {
933
+                if ( ! $joinColumn->getType()) {
934 934
                     $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $em));
935 935
                 }
936 936
 
@@ -964,11 +964,11 @@  discard block
 block discarded – undo
964 964
     {
965 965
         $schema = $this->getSchemaName() === null
966 966
             ? ''
967
-            : $this->getSchemaName() . '_'
967
+            : $this->getSchemaName().'_'
968 968
         ;
969 969
 
970 970
         // replace dots with underscores because PostgreSQL creates temporary tables in a special schema
971
-        return $schema . $this->getTableName() . '_id_tmp';
971
+        return $schema.$this->getTableName().'_id_tmp';
972 972
     }
973 973
 
974 974
     /**
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
      */
1003 1003
     public function setInheritanceType($type) : void
1004 1004
     {
1005
-        if (! $this->isInheritanceType($type)) {
1005
+        if ( ! $this->isInheritanceType($type)) {
1006 1006
             throw MappingException::invalidInheritanceType($this->className, $type);
1007 1007
         }
1008 1008
 
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
     {
1021 1021
         $fieldName = $property->getName();
1022 1022
 
1023
-        if (! isset($this->declaredProperties[$fieldName])) {
1023
+        if ( ! isset($this->declaredProperties[$fieldName])) {
1024 1024
             throw MappingException::invalidOverrideFieldName($this->className, $fieldName);
1025 1025
         }
1026 1026
 
@@ -1217,7 +1217,7 @@  discard block
 block discarded – undo
1217 1217
         $declaringClass    = $property->getDeclaringClass();
1218 1218
 
1219 1219
         if ($inheritedProperty instanceof FieldMetadata) {
1220
-            if (! $declaringClass->isMappedSuperclass) {
1220
+            if ( ! $declaringClass->isMappedSuperclass) {
1221 1221
                 $inheritedProperty->setTableName($property->getTableName());
1222 1222
             }
1223 1223
 
@@ -1328,11 +1328,11 @@  discard block
 block discarded – undo
1328 1328
             'method' => $method,
1329 1329
         ];
1330 1330
 
1331
-        if (! class_exists($class)) {
1331
+        if ( ! class_exists($class)) {
1332 1332
             throw MappingException::entityListenerClassNotFound($class, $this->className);
1333 1333
         }
1334 1334
 
1335
-        if (! method_exists($class, $method)) {
1335
+        if ( ! method_exists($class, $method)) {
1336 1336
             throw MappingException::entityListenerMethodNotFound($class, $method, $this->className);
1337 1337
         }
1338 1338
 
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
             return;
1400 1400
         }
1401 1401
 
1402
-        if (! (class_exists($className) || interface_exists($className))) {
1402
+        if ( ! (class_exists($className) || interface_exists($className))) {
1403 1403
             throw MappingException::invalidClassInDiscriminatorMap($className, $this->className);
1404 1404
         }
1405 1405
 
Please login to merge, or discard this patch.