Passed
Pull Request — master (#7643)
by
unknown
09:33
created
Doctrine/Tests/ORM/Mapping/NamingStrategy/TablePrefixNamingStrategy.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function propertyToColumnName($propertyName, $className = null)
34 34
     {
35
-        return $this->classToTableName($className) . '_' . $propertyName;
35
+        return $this->classToTableName($className).'_'.$propertyName;
36 36
     }
37 37
 
38 38
     /**
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function embeddedFieldToColumnName($propertyName, $embeddedColumnName, $className = null, $embeddedClassName = null)
42 42
     {
43
-        return $this->classToTableName($className) . '_' . $propertyName . '_' . $embeddedColumnName;
43
+        return $this->classToTableName($className).'_'.$propertyName.'_'.$embeddedColumnName;
44 44
     }
45 45
 
46 46
     /**
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public function referenceColumnName($targetEntity = null)
50 50
     {
51
-        return $this->classToTableName($targetEntity) . '_' . 'id';
51
+        return $this->classToTableName($targetEntity).'_'.'id';
52 52
     }
53 53
 
54 54
     /**
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function joinColumnName($propertyName, $className = null)
58 58
     {
59
-        return $this->classToTableName($className) . '_' . $propertyName . '_id';
59
+        return $this->classToTableName($className).'_'.$propertyName.'_id';
60 60
     }
61 61
 
62 62
     /**
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      */
65 65
     public function joinTableName($sourceEntity, $targetEntity, $propertyName = null)
66 66
     {
67
-        return strtolower($this->classToTableName($sourceEntity) . '_' .
67
+        return strtolower($this->classToTableName($sourceEntity).'_'.
68 68
             $this->classToTableName($targetEntity));
69 69
     }
70 70
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public function joinKeyColumnName($entityName, $referencedColumnName = null, $joinTableName = null)
75 75
     {
76
-        return $joinTableName . '_' . strtolower($this->classToTableName($entityName) . '_' .
76
+        return $joinTableName.'_'.strtolower($this->classToTableName($entityName).'_'.
77 77
             ($referencedColumnName ?: 'id'));
78 78
     }
79 79
 }
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/Factory/DefaultNamingStrategy.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function embeddedFieldToColumnName($propertyName, $embeddedColumnName, $className = null, $embeddedClassName = null)
41 41
     {
42
-        return $propertyName . '_' . $embeddedColumnName;
42
+        return $propertyName.'_'.$embeddedColumnName;
43 43
     }
44 44
 
45 45
     /**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function joinColumnName($propertyName, $className = null)
57 57
     {
58
-        return $propertyName . '_' . $this->referenceColumnName();
58
+        return $propertyName.'_'.$this->referenceColumnName();
59 59
     }
60 60
 
61 61
     /**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function joinTableName($sourceEntity, $targetEntity, $propertyName = null)
65 65
     {
66
-        return strtolower($this->classToTableName($sourceEntity) . '_' .
66
+        return strtolower($this->classToTableName($sourceEntity).'_'.
67 67
             $this->classToTableName($targetEntity));
68 68
     }
69 69
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function joinKeyColumnName($entityName, $referencedColumnName = null, $joinTableName = null)
74 74
     {
75
-        return strtolower($this->classToTableName($entityName) . '_' .
75
+        return strtolower($this->classToTableName($entityName).'_'.
76 76
             ($referencedColumnName ?: $this->referenceColumnName()));
77 77
     }
78 78
 }
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/Factory/UnderscoreNamingStrategy.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function embeddedFieldToColumnName($propertyName, $embeddedColumnName, $className = null, $embeddedClassName = null)
78 78
     {
79
-        return $this->underscore($propertyName) . '_' . $embeddedColumnName;
79
+        return $this->underscore($propertyName).'_'.$embeddedColumnName;
80 80
     }
81 81
 
82 82
     /**
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function joinColumnName($propertyName, $className = null)
94 94
     {
95
-        return $this->underscore($propertyName) . '_' . $this->referenceColumnName();
95
+        return $this->underscore($propertyName).'_'.$this->referenceColumnName();
96 96
     }
97 97
 
98 98
     /**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      */
101 101
     public function joinTableName($sourceEntity, $targetEntity, $propertyName = null)
102 102
     {
103
-        return $this->classToTableName($sourceEntity) . '_' . $this->classToTableName($targetEntity);
103
+        return $this->classToTableName($sourceEntity).'_'.$this->classToTableName($targetEntity);
104 104
     }
105 105
 
106 106
     /**
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function joinKeyColumnName($entityName, $referencedColumnName = null, $joinTableName = null)
110 110
     {
111
-        return $this->classToTableName($entityName) . '_' .
111
+        return $this->classToTableName($entityName).'_'.
112 112
                 ($referencedColumnName ?: $this->referenceColumnName());
113 113
     }
114 114
 
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/ClassMetadata.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
      */
263 263
     public function __toString()
264 264
     {
265
-        return self::class . '@' . spl_object_id($this);
265
+        return self::class.'@'.spl_object_id($this);
266 266
     }
267 267
 
268 268
     /**
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
         // Restore ReflectionClass and properties
350 350
         $this->reflectionClass = $reflectionService->getClass($this->className);
351 351
 
352
-        if (! $this->reflectionClass) {
352
+        if ( ! $this->reflectionClass) {
353 353
             return;
354 354
         }
355 355
 
@@ -373,11 +373,11 @@  discard block
 block discarded – undo
373 373
         }
374 374
 
375 375
         // Verify & complete identifier mapping
376
-        if (! $this->identifier) {
376
+        if ( ! $this->identifier) {
377 377
             throw MappingException::identifierRequired($this->className);
378 378
         }
379 379
 
380
-        $explicitlyGeneratedProperties = array_filter($this->declaredProperties, static function (Property $property) : bool {
380
+        $explicitlyGeneratedProperties = array_filter($this->declaredProperties, static function(Property $property) : bool {
381 381
             return $property instanceof FieldMetadata
382 382
                 && $property->isPrimaryKey()
383 383
                 && $property->hasValueGenerator();
@@ -396,14 +396,14 @@  discard block
 block discarded – undo
396 396
     public function validateAssociations() : void
397 397
     {
398 398
         array_map(
399
-            function (Property $property) {
400
-                if (! ($property instanceof AssociationMetadata)) {
399
+            function(Property $property) {
400
+                if ( ! ($property instanceof AssociationMetadata)) {
401 401
                     return;
402 402
                 }
403 403
 
404 404
                 $targetEntity = $property->getTargetEntity();
405 405
 
406
-                if (! class_exists($targetEntity)) {
406
+                if ( ! class_exists($targetEntity)) {
407 407
                     throw MappingException::invalidTargetEntityClass($targetEntity, $this->className, $property->getName());
408 408
                 }
409 409
             },
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
         foreach ($this->lifecycleCallbacks as $callbacks) {
422 422
             /** @var array $callbacks */
423 423
             foreach ($callbacks as $callbackFuncName) {
424
-                if (! $reflectionService->hasPublicMethod($this->className, $callbackFuncName)) {
424
+                if ( ! $reflectionService->hasPublicMethod($this->className, $callbackFuncName)) {
425 425
                     throw MappingException::lifecycleCallbackMethodNotFound($this->className, $callbackFuncName);
426 426
                 }
427 427
             }
@@ -445,11 +445,11 @@  discard block
 block discarded – undo
445 445
      */
446 446
     public function isIdentifier(string $fieldName) : bool
447 447
     {
448
-        if (! $this->identifier) {
448
+        if ( ! $this->identifier) {
449 449
             return false;
450 450
         }
451 451
 
452
-        if (! $this->isIdentifierComposite()) {
452
+        if ( ! $this->isIdentifierComposite()) {
453 453
             return $fieldName === $this->identifier[0];
454 454
         }
455 455
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
             $property->setColumnName($columnName);
478 478
         }
479 479
 
480
-        if (! $this->isMappedSuperclass) {
480
+        if ( ! $this->isMappedSuperclass) {
481 481
             $property->setTableName($this->getTableName());
482 482
         }
483 483
 
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
                 throw MappingException::sqlConversionNotAllowedForPrimaryKeyProperties($this->className, $property);
498 498
             }
499 499
 
500
-            if (! in_array($fieldName, $this->identifier, true)) {
500
+            if ( ! in_array($fieldName, $this->identifier, true)) {
501 501
                 $this->identifier[] = $fieldName;
502 502
             }
503 503
         }
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
         $fieldName    = $property->getName();
548 548
         $targetEntity = $property->getTargetEntity();
549 549
 
550
-        if (! $targetEntity) {
550
+        if ( ! $targetEntity) {
551 551
             throw MappingException::missingTargetEntity($fieldName);
552 552
         }
553 553
 
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
                 throw MappingException::illegalOrphanRemovalOnIdentifierAssociation($this->className, $fieldName);
561 561
             }
562 562
 
563
-            if (! in_array($property->getName(), $this->identifier, true)) {
563
+            if ( ! in_array($property->getName(), $this->identifier, true)) {
564 564
                 if ($property instanceof ToOneAssociationMetadata && count($property->getJoinColumns()) >= 2) {
565 565
                     throw MappingException::cannotMapCompositePrimaryKeyEntitiesAsForeignId(
566 566
                         $property->getTargetEntity(),
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
                 /** @var JoinColumnMetadata $joinColumn */
623 623
                 if ($property instanceof OneToOneAssociationMetadata && $this->inheritanceType !== InheritanceType::SINGLE_TABLE) {
624 624
                     if (count($property->getJoinColumns()) === 1) {
625
-                        if (! $property->isPrimaryKey()) {
625
+                        if ( ! $property->isPrimaryKey()) {
626 626
                             $joinColumn->setUnique(true);
627 627
                         }
628 628
                     } else {
@@ -630,13 +630,13 @@  discard block
 block discarded – undo
630 630
                     }
631 631
                 }
632 632
 
633
-                $joinColumn->setTableName(! $this->isMappedSuperclass ? $this->getTableName() : null);
633
+                $joinColumn->setTableName( ! $this->isMappedSuperclass ? $this->getTableName() : null);
634 634
 
635
-                if (! $joinColumn->getColumnName()) {
635
+                if ( ! $joinColumn->getColumnName()) {
636 636
                     $joinColumn->setColumnName($this->namingStrategy->joinColumnName($fieldName, $this->className));
637 637
                 }
638 638
 
639
-                if (! $joinColumn->getReferencedColumnName()) {
639
+                if ( ! $joinColumn->getReferencedColumnName()) {
640 640
                     $joinColumn->setReferencedColumnName($this->namingStrategy->referenceColumnName($property->getTargetEntity()));
641 641
                 }
642 642
 
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
             }
645 645
 
646 646
             if ($uniqueConstraintColumns) {
647
-                if (! $this->table) {
647
+                if ( ! $this->table) {
648 648
                     throw new RuntimeException(
649 649
                         'ClassMetadata::setTable() has to be called before defining a one to one relationship.'
650 650
                     );
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
         if ($property->isOrphanRemoval()) {
665 665
             $cascades = $property->getCascade();
666 666
 
667
-            if (! in_array('remove', $cascades, true)) {
667
+            if ( ! in_array('remove', $cascades, true)) {
668 668
                 $cascades[] = 'remove';
669 669
 
670 670
                 $property->setCascade($cascades);
@@ -727,14 +727,14 @@  discard block
 block discarded – undo
727 727
     protected function validateAndCompleteOneToManyMapping(OneToManyAssociationMetadata $property)
728 728
     {
729 729
         // OneToMany MUST have mappedBy
730
-        if (! $property->getMappedBy()) {
730
+        if ( ! $property->getMappedBy()) {
731 731
             throw MappingException::oneToManyRequiresMappedBy($property->getName());
732 732
         }
733 733
 
734 734
         if ($property->isOrphanRemoval()) {
735 735
             $cascades = $property->getCascade();
736 736
 
737
-            if (! in_array('remove', $cascades, true)) {
737
+            if ( ! in_array('remove', $cascades, true)) {
738 738
                 $cascades[] = 'remove';
739 739
 
740 740
                 $property->setCascade($cascades);
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 
758 758
             $property->setJoinTable($joinTable);
759 759
 
760
-            if (! $joinTable->getName()) {
760
+            if ( ! $joinTable->getName()) {
761 761
                 $joinTableName = $this->namingStrategy->joinTableName(
762 762
                     $property->getSourceEntity(),
763 763
                     $property->getTargetEntity(),
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
 
770 770
             $selfReferencingEntityWithoutJoinColumns = $property->getSourceEntity() === $property->getTargetEntity() && ! $joinTable->hasColumns();
771 771
 
772
-            if (! $joinTable->getJoinColumns()) {
772
+            if ( ! $joinTable->getJoinColumns()) {
773 773
                 $referencedColumnName = $this->namingStrategy->referenceColumnName($property->getTargetEntity());
774 774
                 $sourceReferenceName  = $selfReferencingEntityWithoutJoinColumns ? 'source' : $referencedColumnName;
775 775
                 $columnName           = $this->namingStrategy->joinKeyColumnName($property->getSourceEntity(), $sourceReferenceName, $joinTable->getName());
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
                 $joinTable->addJoinColumn($joinColumn);
783 783
             }
784 784
 
785
-            if (! $joinTable->getInverseJoinColumns()) {
785
+            if ( ! $joinTable->getInverseJoinColumns()) {
786 786
                 $referencedColumnName = $this->namingStrategy->referenceColumnName($property->getTargetEntity());
787 787
                 $targetReferenceName  = $selfReferencingEntityWithoutJoinColumns ? 'target' : $referencedColumnName;
788 788
                 $columnName           = $this->namingStrategy->joinKeyColumnName($property->getTargetEntity(), $targetReferenceName, $joinTable->getName());
@@ -797,13 +797,13 @@  discard block
 block discarded – undo
797 797
 
798 798
             foreach ($joinTable->getJoinColumns() as $joinColumn) {
799 799
                 /** @var JoinColumnMetadata $joinColumn */
800
-                if (! $joinColumn->getReferencedColumnName()) {
800
+                if ( ! $joinColumn->getReferencedColumnName()) {
801 801
                     $joinColumn->setReferencedColumnName($this->namingStrategy->referenceColumnName($property->getTargetEntity()));
802 802
                 }
803 803
 
804 804
                 $referencedColumnName = $joinColumn->getReferencedColumnName();
805 805
 
806
-                if (! $joinColumn->getColumnName()) {
806
+                if ( ! $joinColumn->getColumnName()) {
807 807
                     $columnName = $this->namingStrategy->joinKeyColumnName(
808 808
                         $property->getSourceEntity(),
809 809
                         $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($property->getTargetEntity()));
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,
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
             throw MappingException::singleIdNotAllowedOnCompositePrimaryKey($this->className);
858 858
         }
859 859
 
860
-        if (! isset($this->identifier[0])) {
860
+        if ( ! isset($this->identifier[0])) {
861 861
             throw MappingException::noIdDefined($this->className);
862 862
         }
863 863
 
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
             // Association defined as Id field
917 917
             $targetClass = $em->getClassMetadata($property->getTargetEntity());
918 918
 
919
-            if (! $property->isOwningSide()) {
919
+            if ( ! $property->isOwningSide()) {
920 920
                 $property    = $targetClass->getProperty($property->getMappedBy());
921 921
                 $targetClass = $em->getClassMetadata($property->getTargetEntity());
922 922
             }
@@ -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,10 +964,10 @@  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
         // replace dots with underscores because PostgreSQL creates temporary tables in a special schema
970
-        return $schema . $this->getTableName() . '_id_tmp';
970
+        return $schema.$this->getTableName().'_id_tmp';
971 971
     }
972 972
 
973 973
     /**
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
      */
1002 1002
     public function setInheritanceType($type) : void
1003 1003
     {
1004
-        if (! $this->isInheritanceType($type)) {
1004
+        if ( ! $this->isInheritanceType($type)) {
1005 1005
             throw MappingException::invalidInheritanceType($this->className, $type);
1006 1006
         }
1007 1007
 
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
     {
1020 1020
         $fieldName = $property->getName();
1021 1021
 
1022
-        if (! isset($this->declaredProperties[$fieldName])) {
1022
+        if ( ! isset($this->declaredProperties[$fieldName])) {
1023 1023
             throw MappingException::invalidOverrideFieldName($this->className, $fieldName);
1024 1024
         }
1025 1025
 
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
         $declaringClass    = $property->getDeclaringClass();
1217 1217
 
1218 1218
         if ($inheritedProperty instanceof FieldMetadata) {
1219
-            if (! $declaringClass->isMappedSuperclass) {
1219
+            if ( ! $declaringClass->isMappedSuperclass) {
1220 1220
                 $inheritedProperty->setTableName($property->getTableName());
1221 1221
             }
1222 1222
 
@@ -1327,11 +1327,11 @@  discard block
 block discarded – undo
1327 1327
             'method' => $method,
1328 1328
         ];
1329 1329
 
1330
-        if (! class_exists($class)) {
1330
+        if ( ! class_exists($class)) {
1331 1331
             throw MappingException::entityListenerClassNotFound($class, $this->className);
1332 1332
         }
1333 1333
 
1334
-        if (! method_exists($class, $method)) {
1334
+        if ( ! method_exists($class, $method)) {
1335 1335
             throw MappingException::entityListenerMethodNotFound($class, $method, $this->className);
1336 1336
         }
1337 1337
 
@@ -1398,7 +1398,7 @@  discard block
 block discarded – undo
1398 1398
             return;
1399 1399
         }
1400 1400
 
1401
-        if (! (class_exists($className) || interface_exists($className))) {
1401
+        if ( ! (class_exists($className) || interface_exists($className))) {
1402 1402
             throw MappingException::invalidClassInDiscriminatorMap($className, $this->className);
1403 1403
         }
1404 1404
 
Please login to merge, or discard this patch.