Completed
Pull Request — develop (#6878)
by Michael
237:13 queued 172:06
created
lib/Doctrine/ORM/UnitOfWork.php 1 patch
Spacing   +33 added lines, -33 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
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
             // Entity deletions come last and need to be in reverse commit order
390 390
             if ($this->entityDeletions) {
391 391
                 foreach (array_reverse($commitOrder) as $committedEntityName) {
392
-                    if (! $this->entityDeletions) {
392
+                    if ( ! $this->entityDeletions) {
393 393
                         break; // just a performance optimisation
394 394
                     }
395 395
 
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
         $oid  = spl_object_id($entity);
475 475
         $data = [];
476 476
 
477
-        if (!isset($this->entityChangeSets[$oid])) {
477
+        if ( ! isset($this->entityChangeSets[$oid])) {
478 478
             return $data;
479 479
         }
480 480
 
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
                     || ! $class->getProperty($name) instanceof FieldMetadata
558 558
                     || ! $class->getProperty($name)->hasValueGenerator()
559 559
                     || $class->getProperty($name)->getValueGenerator()->getType() !== GeneratorType::IDENTITY
560
-                ) && (! $class->isVersioned() || $name !== $class->versionProperty->getName())) {
560
+                ) && ( ! $class->isVersioned() || $name !== $class->versionProperty->getName())) {
561 561
                 $actualData[$name] = $value;
562 562
             }
563 563
         }
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
                     if ($owner === null) { // cloned
612 612
                         $actualValue->setOwner($entity, $property);
613 613
                     } else if ($owner !== $entity) { // no clone, we have to fix
614
-                        if (! $actualValue->isInitialized()) {
614
+                        if ( ! $actualValue->isInitialized()) {
615 615
                             $actualValue->initialize(); // we have to do this otherwise the cols share state
616 616
                         }
617 617
 
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
                             // A PersistentCollection was de-referenced, so delete it.
652 652
                             $coid = spl_object_id($orgValue);
653 653
 
654
-                            if (!isset($this->collectionDeletions[$coid])) {
654
+                            if ( ! isset($this->collectionDeletions[$coid])) {
655 655
                                 $this->collectionDeletions[$coid] = $orgValue;
656 656
                                 $changeSet[$propName] = $orgValue; // Signal changeset, to-many associations will be ignored
657 657
                             }
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 
674 674
         // Look for changes in associations of the entity
675 675
         foreach ($class->getDeclaredPropertiesIterator() as $property) {
676
-            if (! ($property instanceof AssociationMetadata) || ($value = $property->getValue($entity)) === null) {
676
+            if ( ! ($property instanceof AssociationMetadata) || ($value = $property->getValue($entity)) === null) {
677 677
                 continue;
678 678
             }
679 679
 
@@ -777,13 +777,13 @@  discard block
 block discarded – undo
777 777
         $targetClass    = $this->em->getClassMetadata($targetEntity);
778 778
 
779 779
         foreach ($unwrappedValue as $key => $entry) {
780
-            if (! ($entry instanceof $targetEntity)) {
780
+            if ( ! ($entry instanceof $targetEntity)) {
781 781
                 throw ORMInvalidArgumentException::invalidAssociation($targetClass, $association, $entry);
782 782
             }
783 783
 
784 784
             $state = $this->getEntityState($entry, self::STATE_NEW);
785 785
 
786
-            if (! ($entry instanceof $targetEntity)) {
786
+            if ( ! ($entry instanceof $targetEntity)) {
787 787
                 throw ORMException::unexpectedAssociationValue(
788 788
                     $association->getSourceEntity(),
789 789
                     $association->getName(),
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
         $persister = $this->getEntityPersister($class->getClassName());
846 846
         $generationPlan->executeImmediate($this->em, $entity);
847 847
 
848
-        if (! $generationPlan->containsDeferred()) {
848
+        if ( ! $generationPlan->containsDeferred()) {
849 849
             $id = $this->em->getIdentifierFlattener()->flattenIdentifier($class, $persister->getIdentifier($entity));
850 850
             $this->entityIdentifiers[$oid] = $id;
851 851
         }
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
     {
879 879
         $oid = spl_object_id($entity);
880 880
 
881
-        if (! isset($this->entityStates[$oid]) || $this->entityStates[$oid] !== self::STATE_MANAGED) {
881
+        if ( ! isset($this->entityStates[$oid]) || $this->entityStates[$oid] !== self::STATE_MANAGED) {
882 882
             throw ORMInvalidArgumentException::entityNotManaged($entity);
883 883
         }
884 884
 
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
                     break;
901 901
 
902 902
                 case ($property instanceof FieldMetadata):
903
-                    if (! $property->isPrimaryKey()
903
+                    if ( ! $property->isPrimaryKey()
904 904
                         || ! $property->getValueGenerator()
905 905
                         || $property->getValueGenerator()->getType() !== GeneratorType::IDENTITY) {
906 906
                         $actualData[$name] = $property->getValue($entity);
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
             // Entity with this $oid after deletion treated as NEW, even if the $oid
1054 1054
             // is obtained by a new entity because the old one went out of scope.
1055 1055
             //$this->entityStates[$oid] = self::STATE_NEW;
1056
-            if (! $class->isIdentifierComposite()) {
1056
+            if ( ! $class->isIdentifierComposite()) {
1057 1057
                 $property = $class->getProperty($class->getSingleIdentifierFieldName());
1058 1058
 
1059 1059
                 if ($property instanceof FieldMetadata && $property->hasValueGenerator()) {
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
         // Calculate dependencies for new nodes
1101 1101
         while ($class = array_pop($newNodes)) {
1102 1102
             foreach ($class->getDeclaredPropertiesIterator() as $property) {
1103
-                if (! ($property instanceof ToOneAssociationMetadata && $property->isOwningSide())) {
1103
+                if ( ! ($property instanceof ToOneAssociationMetadata && $property->isOwningSide())) {
1104 1104
                     continue;
1105 1105
                 }
1106 1106
 
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
 
1115 1115
                 $weight = ! array_filter(
1116 1116
                     $property->getJoinColumns(),
1117
-                    function (JoinColumnMetadata $joinColumn) { return $joinColumn->isNullable(); }
1117
+                    function(JoinColumnMetadata $joinColumn) { return $joinColumn->isNullable(); }
1118 1118
                 );
1119 1119
 
1120 1120
                 $calc->addDependency($targetClass->getClassName(), $class->getClassName(), $weight);
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
         $persister = $this->getEntityPersister($class->getClassName());
1409 1409
         $id        = $persister->getIdentifier($entity);
1410 1410
 
1411
-        if (! $id) {
1411
+        if ( ! $id) {
1412 1412
             return self::STATE_NEW;
1413 1413
         }
1414 1414
 
@@ -1641,7 +1641,7 @@  discard block
 block discarded – undo
1641 1641
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "persisted");
1642 1642
 
1643 1643
             default:
1644
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1644
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1645 1645
         }
1646 1646
 
1647 1647
         $this->cascadePersist($entity, $visited);
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
             case self::STATE_DETACHED:
1712 1712
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "removed");
1713 1713
             default:
1714
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1714
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1715 1715
         }
1716 1716
 
1717 1717
     }
@@ -1780,7 +1780,7 @@  discard block
 block discarded – undo
1780 1780
         $class = $this->em->getClassMetadata(get_class($entity));
1781 1781
 
1782 1782
         foreach ($class->getDeclaredPropertiesIterator() as $association) {
1783
-            if (! ($association instanceof AssociationMetadata && in_array('refresh', $association->getCascade()))) {
1783
+            if ( ! ($association instanceof AssociationMetadata && in_array('refresh', $association->getCascade()))) {
1784 1784
                 continue;
1785 1785
             }
1786 1786
 
@@ -1827,7 +1827,7 @@  discard block
 block discarded – undo
1827 1827
         }
1828 1828
 
1829 1829
         foreach ($class->getDeclaredPropertiesIterator() as $association) {
1830
-            if (! ($association instanceof AssociationMetadata && in_array('persist', $association->getCascade()))) {
1830
+            if ( ! ($association instanceof AssociationMetadata && in_array('persist', $association->getCascade()))) {
1831 1831
                 continue;
1832 1832
             }
1833 1833
 
@@ -1843,7 +1843,7 @@  discard block
 block discarded – undo
1843 1843
 
1844 1844
                 case ($relatedEntities instanceof Collection):
1845 1845
                 case (is_array($relatedEntities)):
1846
-                    if (! ($association instanceof ToManyAssociationMetadata)) {
1846
+                    if ( ! ($association instanceof ToManyAssociationMetadata)) {
1847 1847
                         throw ORMInvalidArgumentException::invalidAssociation(
1848 1848
                             $this->em->getClassMetadata($targetEntity),
1849 1849
                             $association,
@@ -1858,7 +1858,7 @@  discard block
 block discarded – undo
1858 1858
                     break;
1859 1859
 
1860 1860
                 case ($relatedEntities !== null):
1861
-                    if (! $relatedEntities instanceof $targetEntity) {
1861
+                    if ( ! $relatedEntities instanceof $targetEntity) {
1862 1862
                         throw ORMInvalidArgumentException::invalidAssociation(
1863 1863
                             $this->em->getClassMetadata($targetEntity),
1864 1864
                             $association,
@@ -1889,7 +1889,7 @@  discard block
 block discarded – undo
1889 1889
         $class             = $this->em->getClassMetadata(get_class($entity));
1890 1890
 
1891 1891
         foreach ($class->getDeclaredPropertiesIterator() as $association) {
1892
-            if (! ($association instanceof AssociationMetadata && in_array('remove', $association->getCascade()))) {
1892
+            if ( ! ($association instanceof AssociationMetadata && in_array('remove', $association->getCascade()))) {
1893 1893
                 continue;
1894 1894
             }
1895 1895
 
@@ -1972,7 +1972,7 @@  discard block
 block discarded – undo
1972 1972
             case LockMode::NONE === $lockMode:
1973 1973
             case LockMode::PESSIMISTIC_READ === $lockMode:
1974 1974
             case LockMode::PESSIMISTIC_WRITE === $lockMode:
1975
-                if (!$this->em->getConnection()->isTransactionActive()) {
1975
+                if ( ! $this->em->getConnection()->isTransactionActive()) {
1976 1976
                     throw TransactionRequiredException::transactionRequired();
1977 1977
                 }
1978 1978
 
@@ -2196,7 +2196,7 @@  discard block
 block discarded – undo
2196 2196
         }
2197 2197
 
2198 2198
         foreach ($class->getDeclaredPropertiesIterator() as $field => $association) {
2199
-            if (! ($association instanceof AssociationMetadata)) {
2199
+            if ( ! ($association instanceof AssociationMetadata)) {
2200 2200
                 continue;
2201 2201
             }
2202 2202
 
@@ -2245,7 +2245,7 @@  discard block
 block discarded – undo
2245 2245
                 continue;
2246 2246
             }
2247 2247
 
2248
-            if (! $association->isOwningSide()) {
2248
+            if ( ! $association->isOwningSide()) {
2249 2249
                 // use the given entity association
2250 2250
                 if (isset($data[$field]) && is_object($data[$field]) &&
2251 2251
                     isset($this->entityStates[spl_object_id($data[$field])])) {
@@ -2295,7 +2295,7 @@  discard block
 block discarded – undo
2295 2295
                 $associatedId[$targetField] = $joinColumnValue;
2296 2296
             }
2297 2297
 
2298
-            if (! $associatedId) {
2298
+            if ( ! $associatedId) {
2299 2299
                 // Foreign key is NULL
2300 2300
                 $association->setValue($entity, null);
2301 2301
                 $this->originalEntityData[$oid][$field] = null;
@@ -2304,7 +2304,7 @@  discard block
 block discarded – undo
2304 2304
             }
2305 2305
 
2306 2306
             // @todo guilhermeblanco Can we remove the need of this somehow?
2307
-            if (!isset($hints['fetchMode'][$class->getClassName()][$field])) {
2307
+            if ( ! isset($hints['fetchMode'][$class->getClassName()][$field])) {
2308 2308
                 $hints['fetchMode'][$class->getClassName()][$field] = $association->getFetchMode();
2309 2309
             }
2310 2310
 
@@ -2321,7 +2321,7 @@  discard block
 block discarded – undo
2321 2321
                     // If this is an uninitialized proxy, we are deferring eager loads,
2322 2322
                     // this association is marked as eager fetch, and its an uninitialized proxy (wtf!)
2323 2323
                     // then we can append this entity for eager loading!
2324
-                    if (!$targetClass->isIdentifierComposite() &&
2324
+                    if ( ! $targetClass->isIdentifierComposite() &&
2325 2325
                         $newValue instanceof GhostObjectInterface &&
2326 2326
                         isset($hints[self::HINT_DEFEREAGERLOAD]) &&
2327 2327
                         $hints['fetchMode'][$class->getClassName()][$field] === FetchMode::EAGER &&
@@ -2358,7 +2358,7 @@  discard block
 block discarded – undo
2358 2358
                             break;
2359 2359
 
2360 2360
                         // Deferred eager load only works for single identifier classes
2361
-                        case (isset($hints[self::HINT_DEFEREAGERLOAD]) && !$targetClass->isIdentifierComposite()):
2361
+                        case (isset($hints[self::HINT_DEFEREAGERLOAD]) && ! $targetClass->isIdentifierComposite()):
2362 2362
                             // TODO: Is there a faster approach?
2363 2363
                             $this->eagerLoadingEntities[$targetClass->getRootClassName()][$relatedIdHash] = current($normalizedAssociatedId);
2364 2364
 
@@ -2765,7 +2765,7 @@  discard block
 block discarded – undo
2765 2765
     {
2766 2766
         $class = $this->em->getClassMetadata(get_class($entity));
2767 2767
 
2768
-        if (! $class->getProperty($propertyName)) {
2768
+        if ( ! $class->getProperty($propertyName)) {
2769 2769
             return; // ignore non-persistent fields
2770 2770
         }
2771 2771
 
@@ -2905,7 +2905,7 @@  discard block
 block discarded – undo
2905 2905
      */
2906 2906
     private function afterTransactionComplete()
2907 2907
     {
2908
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
2908
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
2909 2909
             $persister->afterTransactionComplete();
2910 2910
         });
2911 2911
     }
@@ -2915,7 +2915,7 @@  discard block
 block discarded – undo
2915 2915
      */
2916 2916
     private function afterTransactionRolledBack()
2917 2917
     {
2918
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
2918
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
2919 2919
             $persister->afterTransactionRolledBack();
2920 2920
         });
2921 2921
     }
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Tools/DebugUnitOfWorkListener.php 1 patch
Spacing   +12 added lines, -12 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\Tools;
6 6
 
@@ -77,20 +77,20 @@  discard block
 block discarded – undo
77 77
         fwrite($fh, "Flush Operation [".$this->context."] - Dumping identity map:\n");
78 78
 
79 79
         foreach ($identityMap as $className => $map) {
80
-            fwrite($fh, "Class: ". $className . "\n");
80
+            fwrite($fh, "Class: ".$className."\n");
81 81
 
82 82
             foreach ($map as $entity) {
83
-                fwrite($fh, " Entity: " . $this->getIdString($entity, $uow) . " " . spl_object_id($entity)."\n");
83
+                fwrite($fh, " Entity: ".$this->getIdString($entity, $uow)." ".spl_object_id($entity)."\n");
84 84
                 fwrite($fh, "  Associations:\n");
85 85
 
86 86
                 $cm = $em->getClassMetadata($className);
87 87
 
88 88
                 foreach ($cm->getDeclaredPropertiesIterator() as $field => $association) {
89
-                    if (! ($association instanceof AssociationMetadata)) {
89
+                    if ( ! ($association instanceof AssociationMetadata)) {
90 90
                         continue;
91 91
                     }
92 92
 
93
-                    fwrite($fh, "   " . $field . " ");
93
+                    fwrite($fh, "   ".$field." ");
94 94
 
95 95
                     $value = $association->getValue($entity);
96 96
 
@@ -101,25 +101,25 @@  discard block
 block discarded – undo
101 101
                     }
102 102
 
103 103
                     if ($association instanceof ToOneAssociationMetadata) {
104
-                        if ($value instanceof GhostObjectInterface && !$value->isProxyInitialized()) {
104
+                        if ($value instanceof GhostObjectInterface && ! $value->isProxyInitialized()) {
105 105
                             fwrite($fh, "[PROXY] ");
106 106
                         }
107 107
 
108
-                        fwrite($fh, $this->getIdString($value, $uow) . " " . spl_object_id($value) . "\n");
108
+                        fwrite($fh, $this->getIdString($value, $uow)." ".spl_object_id($value)."\n");
109 109
                     } else {
110
-                        $initialized = !($value instanceof PersistentCollection) || $value->isInitialized();
110
+                        $initialized = ! ($value instanceof PersistentCollection) || $value->isInitialized();
111 111
 
112 112
                         if ($initialized) {
113
-                            fwrite($fh, "[INITIALIZED] " . $this->getType($value). " " . count($value) . " elements\n");
113
+                            fwrite($fh, "[INITIALIZED] ".$this->getType($value)." ".count($value)." elements\n");
114 114
 
115 115
                             foreach ($value as $obj) {
116
-                                fwrite($fh, "    " . $this->getIdString($obj, $uow) . " " . spl_object_id($obj)."\n");
116
+                                fwrite($fh, "    ".$this->getIdString($obj, $uow)." ".spl_object_id($obj)."\n");
117 117
                             }
118 118
                         } else {
119
-                            fwrite($fh, "[PROXY] " . $this->getType($value) . " unknown element size\n");
119
+                            fwrite($fh, "[PROXY] ".$this->getType($value)." unknown element size\n");
120 120
 
121 121
                             foreach ($value->unwrap() as $obj) {
122
-                                fwrite($fh, "    " . $this->getIdString($obj, $uow) . " " . spl_object_id($obj)."\n");
122
+                                fwrite($fh, "    ".$this->getIdString($obj, $uow)." ".spl_object_id($obj)."\n");
123 123
                             }
124 124
                         }
125 125
                     }
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php 1 patch
Spacing   +2 added lines, -2 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\Repository;
6 6
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public function getRepository(EntityManagerInterface $entityManager, $entityName)
28 28
     {
29
-        $repositoryHash = $entityManager->getClassMetadata($entityName)->getClassName() . spl_object_id($entityManager);
29
+        $repositoryHash = $entityManager->getClassMetadata($entityName)->getClassName().spl_object_id($entityManager);
30 30
 
31 31
         if (isset($this->repositoryList[$repositoryHash])) {
32 32
             return $this->repositoryList[$repositoryHash];
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php 1 patch
Spacing   +21 added lines, -21 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\Internal\Hydration;
6 6
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     protected function prepare()
69 69
     {
70
-        if (! isset($this->hints[UnitOfWork::HINT_DEFEREAGERLOAD])) {
70
+        if ( ! isset($this->hints[UnitOfWork::HINT_DEFEREAGERLOAD])) {
71 71
             $this->hints[UnitOfWork::HINT_DEFEREAGERLOAD] = true;
72 72
         }
73 73
 
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
 
78 78
             // Remember which associations are "fetch joined", so that we know where to inject
79 79
             // collection stubs or proxies and where not.
80
-            if (! isset($this->rsm->relationMap[$dqlAlias])) {
80
+            if ( ! isset($this->rsm->relationMap[$dqlAlias])) {
81 81
                 continue;
82 82
             }
83 83
 
84 84
             $parent = $this->rsm->parentAliasMap[$dqlAlias];
85 85
 
86
-            if (! isset($this->rsm->aliasMap[$parent])) {
86
+            if ( ! isset($this->rsm->aliasMap[$parent])) {
87 87
                 throw HydrationException::parentObjectOfRelationNotFound($dqlAlias, $parent);
88 88
             }
89 89
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
                 $class        = $this->getClassMetadata($className);
110 110
                 $inverseAssoc = $class->getProperty($association->getInversedBy());
111 111
 
112
-                if (! ($inverseAssoc instanceof ToOneAssociationMetadata)) {
112
+                if ( ! ($inverseAssoc instanceof ToOneAssociationMetadata)) {
113 113
                     continue;
114 114
                 }
115 115
 
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
         $value       = $association->getValue($entity);
176 176
         $oid         = spl_object_id($entity);
177 177
 
178
-        if (! $value instanceof PersistentCollection) {
178
+        if ( ! $value instanceof PersistentCollection) {
179 179
             $value = $association->wrap($entity, $value, $this->em);
180 180
 
181 181
             $association->setValue($entity, $value);
182 182
 
183 183
             $this->uow->setOriginalEntityProperty($oid, $fieldName, $value);
184 184
 
185
-            $this->initializedCollections[$oid . $fieldName] = $value;
185
+            $this->initializedCollections[$oid.$fieldName] = $value;
186 186
         } else if (
187 187
             isset($this->hints[Query::HINT_REFRESH]) ||
188 188
             (isset($this->hints['fetched'][$parentDqlAlias][$fieldName]) && ! $value->isInitialized())
@@ -192,10 +192,10 @@  discard block
 block discarded – undo
192 192
             $value->setInitialized(true);
193 193
             $value->unwrap()->clear();
194 194
 
195
-            $this->initializedCollections[$oid . $fieldName] = $value;
195
+            $this->initializedCollections[$oid.$fieldName] = $value;
196 196
         } else {
197 197
             // Is already PersistentCollection, and DON'T REFRESH or FETCH-JOIN!
198
-            $this->existingCollections[$oid . $fieldName] = $value;
198
+            $this->existingCollections[$oid.$fieldName] = $value;
199 199
         }
200 200
 
201 201
         return $value;
@@ -313,10 +313,10 @@  discard block
 block discarded – undo
313 313
                 $parentAlias = $this->rsm->parentAliasMap[$dqlAlias];
314 314
                 // we need the $path to save into the identifier map which entities were already
315 315
                 // seen for this parent-child relationship
316
-                $path = $parentAlias . '.' . $dqlAlias;
316
+                $path = $parentAlias.'.'.$dqlAlias;
317 317
 
318 318
                 // We have a RIGHT JOIN result here. Doctrine cannot hydrate RIGHT JOIN Object-Graphs
319
-                if (! isset($nonemptyComponents[$parentAlias])) {
319
+                if ( ! isset($nonemptyComponents[$parentAlias])) {
320 320
                     // TODO: Add special case code where we hydrate the right join objects into identity map at least
321 321
                     continue;
322 322
                 }
@@ -347,15 +347,15 @@  discard block
 block discarded – undo
347 347
                 $oid = spl_object_id($parentObject);
348 348
 
349 349
                 // Check the type of the relation (many or single-valued)
350
-                if (! ($association instanceof ToOneAssociationMetadata)) {
350
+                if ( ! ($association instanceof ToOneAssociationMetadata)) {
351 351
                     // PATH A: Collection-valued association
352 352
                     $reflFieldValue = $association->getValue($parentObject);
353 353
 
354 354
                     if (isset($nonemptyComponents[$dqlAlias])) {
355
-                        $collKey = $oid . $relationField;
355
+                        $collKey = $oid.$relationField;
356 356
                         if (isset($this->initializedCollections[$collKey])) {
357 357
                             $reflFieldValue = $this->initializedCollections[$collKey];
358
-                        } else if (! isset($this->existingCollections[$collKey])) {
358
+                        } else if ( ! isset($this->existingCollections[$collKey])) {
359 359
                             $reflFieldValue = $this->initRelatedCollection($parentObject, $parentClass, $relationField, $parentAlias);
360 360
                         }
361 361
 
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
                         $index          = $indexExists ? $this->identifierMap[$path][$id[$parentAlias]][$id[$dqlAlias]] : false;
364 364
                         $indexIsValid   = $index !== false ? isset($reflFieldValue[$index]) : false;
365 365
 
366
-                        if (! $indexExists || ! $indexIsValid) {
366
+                        if ( ! $indexExists || ! $indexIsValid) {
367 367
                             if (isset($this->existingCollections[$collKey])) {
368 368
                                 // Collection exists, only look for the element in the identity map.
369 369
                                 if ($element = $this->getEntityFromIdentityMap($entityName, $data)) {
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
                     // PATH B: Single-valued association
400 400
                     $reflFieldValue = $association->getValue($parentObject);
401 401
 
402
-                    if (! $reflFieldValue || isset($this->hints[Query::HINT_REFRESH]) ||
402
+                    if ( ! $reflFieldValue || isset($this->hints[Query::HINT_REFRESH]) ||
403 403
                         ($reflFieldValue instanceof GhostObjectInterface && ! $reflFieldValue->isProxyInitialized())) {
404 404
                         // we only need to take action if this value is null,
405 405
                         // we refresh the entity or its an uninitialized proxy.
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
                 $entityKey = $this->rsm->entityMappings[$dqlAlias] ?: 0;
461 461
 
462 462
                 // if this row has a NULL value for the root result id then make it a null result.
463
-                if ( ! isset($nonemptyComponents[$dqlAlias]) ) {
463
+                if ( ! isset($nonemptyComponents[$dqlAlias])) {
464 464
                     if ($this->rsm->isMixed) {
465 465
                         $result[] = [$entityKey => null];
466 466
                     } else {
@@ -516,13 +516,13 @@  discard block
 block discarded – undo
516 516
             }
517 517
         }
518 518
 
519
-        if ( ! isset($resultKey) ) {
519
+        if ( ! isset($resultKey)) {
520 520
             $this->resultCounter++;
521 521
         }
522 522
 
523 523
         // Append scalar values to mixed result sets
524 524
         if (isset($rowData['scalars'])) {
525
-            if ( ! isset($resultKey) ) {
525
+            if ( ! isset($resultKey)) {
526 526
                 $resultKey = (isset($this->rsm->indexByMap['scalars']))
527 527
                     ? $row[$this->rsm->indexByMap['scalars']]
528 528
                     : $this->resultCounter - 1;
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 
536 536
         // Append new object to mixed result sets
537 537
         if (isset($rowData['newObjects'])) {
538
-            if ( ! isset($resultKey) ) {
538
+            if ( ! isset($resultKey)) {
539 539
                 $resultKey = $this->resultCounter - 1;
540 540
             }
541 541
 
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
                 $args   = $newObject['args'];
548 548
                 $obj    = $class->newInstanceArgs($args);
549 549
 
550
-                if ($hasNoScalars && \count($rowData['newObjects']) === 1 ) {
550
+                if ($hasNoScalars && \count($rowData['newObjects']) === 1) {
551 551
                     $result[$resultKey] = $obj;
552 552
 
553 553
                     continue;
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/ClassMetadata.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 
4
-declare(strict_types=1);
4
+declare(strict_types = 1);
5 5
 
6 6
 namespace Doctrine\ORM\Mapping;
7 7
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
      */
309 309
     public function __toString()
310 310
     {
311
-        return __CLASS__ . '@' . spl_object_id($this);
311
+        return __CLASS__.'@'.spl_object_id($this);
312 312
     }
313 313
 
314 314
     /**
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
         // Restore ReflectionClass and properties
412 412
         $this->reflectionClass = $reflectionService->getClass($this->className);
413 413
 
414
-        if (! $this->reflectionClass) {
414
+        if ( ! $this->reflectionClass) {
415 415
             return;
416 416
         }
417 417
 
@@ -437,11 +437,11 @@  discard block
 block discarded – undo
437 437
         }
438 438
 
439 439
         // Verify & complete identifier mapping
440
-        if (! $this->identifier) {
440
+        if ( ! $this->identifier) {
441 441
             throw MappingException::identifierRequired($this->className);
442 442
         }
443 443
 
444
-        $explicitlyGeneratedProperties = array_filter($this->declaredProperties, function (Property $property) : bool {
444
+        $explicitlyGeneratedProperties = array_filter($this->declaredProperties, function(Property $property) : bool {
445 445
             return $property instanceof FieldMetadata
446 446
                 && $property->isPrimaryKey()
447 447
                 && $property->hasValueGenerator();
@@ -462,14 +462,14 @@  discard block
 block discarded – undo
462 462
     public function validateAssociations() : void
463 463
     {
464 464
         array_map(
465
-            function (Property $property) {
466
-                if (! ($property instanceof AssociationMetadata)) {
465
+            function(Property $property) {
466
+                if ( ! ($property instanceof AssociationMetadata)) {
467 467
                     return;
468 468
                 }
469 469
 
470 470
                 $targetEntity = $property->getTargetEntity();
471 471
 
472
-                if (! class_exists($targetEntity)) {
472
+                if ( ! class_exists($targetEntity)) {
473 473
                     throw MappingException::invalidTargetEntityClass($targetEntity, $this->className, $property->getName());
474 474
                 }
475 475
             },
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
         foreach ($this->lifecycleCallbacks as $callbacks) {
492 492
             /** @var array $callbacks */
493 493
             foreach ($callbacks as $callbackFuncName) {
494
-                if (! $reflectionService->hasPublicMethod($this->className, $callbackFuncName)) {
494
+                if ( ! $reflectionService->hasPublicMethod($this->className, $callbackFuncName)) {
495 495
                     throw MappingException::lifecycleCallbackMethodNotFound($this->className, $callbackFuncName);
496 496
                 }
497 497
             }
@@ -519,11 +519,11 @@  discard block
 block discarded – undo
519 519
      */
520 520
     public function isIdentifier(string $fieldName) : bool
521 521
     {
522
-        if (! $this->identifier) {
522
+        if ( ! $this->identifier) {
523 523
             return false;
524 524
         }
525 525
 
526
-        if (! $this->isIdentifierComposite()) {
526
+        if ( ! $this->isIdentifierComposite()) {
527 527
             return $fieldName === $this->identifier[0];
528 528
         }
529 529
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
      */
552 552
     public function getNamedQuery($queryName) : string
553 553
     {
554
-        if (! isset($this->namedQueries[$queryName])) {
554
+        if ( ! isset($this->namedQueries[$queryName])) {
555 555
             throw MappingException::queryNotFound($this->className, $queryName);
556 556
         }
557 557
 
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
      */
612 612
     public function getSqlResultSetMapping($name)
613 613
     {
614
-        if (! isset($this->sqlResultSetMappings[$name])) {
614
+        if ( ! isset($this->sqlResultSetMappings[$name])) {
615 615
             throw MappingException::resultMappingNotFound($this->className, $name);
616 616
         }
617 617
 
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
             $property->setColumnName($columnName);
647 647
         }
648 648
 
649
-        if (! $this->isMappedSuperclass) {
649
+        if ( ! $this->isMappedSuperclass) {
650 650
             $property->setTableName($this->getTableName());
651 651
         }
652 652
 
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
                 throw MappingException::sqlConversionNotAllowedForPrimaryKeyProperties($property);
667 667
             };
668 668
 
669
-            if (! in_array($fieldName, $this->identifier)) {
669
+            if ( ! in_array($fieldName, $this->identifier)) {
670 670
                 $this->identifier[] = $fieldName;
671 671
             }
672 672
         }
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
         $fieldName    = $property->getName();
721 721
         $targetEntity = $property->getTargetEntity();
722 722
 
723
-        if (! $targetEntity) {
723
+        if ( ! $targetEntity) {
724 724
             throw MappingException::missingTargetEntity($fieldName);
725 725
         }
726 726
 
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
                 $this->identifier[] = $property->getName();
747 747
             }
748 748
 
749
-            if ($this->cache && !$property->getCache()) {
749
+            if ($this->cache && ! $property->getCache()) {
750 750
                 throw CacheException::nonCacheableEntityAssociation($this->className, $fieldName);
751 751
             }
752 752
 
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
                 /** @var JoinColumnMetadata $joinColumn */
801 801
                 if ($property instanceof OneToOneAssociationMetadata && $this->inheritanceType !== InheritanceType::SINGLE_TABLE) {
802 802
                     if (1 === count($property->getJoinColumns())) {
803
-                        if (! $property->isPrimaryKey()) {
803
+                        if ( ! $property->isPrimaryKey()) {
804 804
                             $joinColumn->setUnique(true);
805 805
                         }
806 806
                     } else {
@@ -808,13 +808,13 @@  discard block
 block discarded – undo
808 808
                     }
809 809
                 }
810 810
 
811
-                $joinColumn->setTableName(! $this->isMappedSuperclass ? $this->getTableName() : null);
811
+                $joinColumn->setTableName( ! $this->isMappedSuperclass ? $this->getTableName() : null);
812 812
 
813
-                if (! $joinColumn->getColumnName()) {
813
+                if ( ! $joinColumn->getColumnName()) {
814 814
                     $joinColumn->setColumnName($this->namingStrategy->joinColumnName($fieldName, $this->className));
815 815
                 }
816 816
 
817
-                if (! $joinColumn->getReferencedColumnName()) {
817
+                if ( ! $joinColumn->getReferencedColumnName()) {
818 818
                     $joinColumn->setReferencedColumnName($this->namingStrategy->referenceColumnName());
819 819
                 }
820 820
 
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
         if ($property->isOrphanRemoval()) {
843 843
             $cascades = $property->getCascade();
844 844
 
845
-            if (! in_array('remove', $cascades)) {
845
+            if ( ! in_array('remove', $cascades)) {
846 846
                 $cascades[] = 'remove';
847 847
 
848 848
                 $property->setCascade($cascades);
@@ -908,14 +908,14 @@  discard block
 block discarded – undo
908 908
         $property->setOwningSide(false);
909 909
 
910 910
         // OneToMany MUST have mappedBy
911
-        if (! $property->getMappedBy()) {
911
+        if ( ! $property->getMappedBy()) {
912 912
             throw MappingException::oneToManyRequiresMappedBy($property->getName());
913 913
         }
914 914
 
915 915
         if ($property->isOrphanRemoval()) {
916 916
             $cascades = $property->getCascade();
917 917
 
918
-            if (! in_array('remove', $cascades)) {
918
+            if ( ! in_array('remove', $cascades)) {
919 919
                 $cascades[] = 'remove';
920 920
 
921 921
                 $property->setCascade($cascades);
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 
939 939
             $property->setJoinTable($joinTable);
940 940
 
941
-            if (! $joinTable->getName()) {
941
+            if ( ! $joinTable->getName()) {
942 942
                 $joinTableName = $this->namingStrategy->joinTableName(
943 943
                     $property->getSourceEntity(),
944 944
                     $property->getTargetEntity(),
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
 
951 951
             $selfReferencingEntityWithoutJoinColumns = $property->getSourceEntity() == $property->getTargetEntity() && ! $joinTable->hasColumns();
952 952
 
953
-            if (! $joinTable->getJoinColumns()) {
953
+            if ( ! $joinTable->getJoinColumns()) {
954 954
                 $referencedColumnName = $this->namingStrategy->referenceColumnName();
955 955
                 $sourceReferenceName  = $selfReferencingEntityWithoutJoinColumns ? 'source' : $referencedColumnName;
956 956
                 $columnName           = $this->namingStrategy->joinKeyColumnName($property->getSourceEntity(), $sourceReferenceName);
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
                 $joinTable->addJoinColumn($joinColumn);
964 964
             }
965 965
 
966
-            if (! $joinTable->getInverseJoinColumns()) {
966
+            if ( ! $joinTable->getInverseJoinColumns()) {
967 967
                 $referencedColumnName = $this->namingStrategy->referenceColumnName();
968 968
                 $targetReferenceName  = $selfReferencingEntityWithoutJoinColumns ? 'target' : $referencedColumnName;
969 969
                 $columnName           = $this->namingStrategy->joinKeyColumnName($property->getTargetEntity(), $targetReferenceName);
@@ -978,13 +978,13 @@  discard block
 block discarded – undo
978 978
 
979 979
             foreach ($joinTable->getJoinColumns() as $joinColumn) {
980 980
                 /** @var JoinColumnMetadata $joinColumn */
981
-                if (! $joinColumn->getReferencedColumnName()) {
981
+                if ( ! $joinColumn->getReferencedColumnName()) {
982 982
                     $joinColumn->setReferencedColumnName($this->namingStrategy->referenceColumnName());
983 983
                 }
984 984
 
985 985
                 $referencedColumnName = $joinColumn->getReferencedColumnName();
986 986
 
987
-                if (! $joinColumn->getColumnName()) {
987
+                if ( ! $joinColumn->getColumnName()) {
988 988
                     $columnName = $this->namingStrategy->joinKeyColumnName(
989 989
                         $property->getSourceEntity(),
990 990
                         $referencedColumnName
@@ -996,13 +996,13 @@  discard block
 block discarded – undo
996 996
 
997 997
             foreach ($joinTable->getInverseJoinColumns() as $inverseJoinColumn) {
998 998
                 /** @var JoinColumnMetadata $inverseJoinColumn */
999
-                if (! $inverseJoinColumn->getReferencedColumnName()) {
999
+                if ( ! $inverseJoinColumn->getReferencedColumnName()) {
1000 1000
                     $inverseJoinColumn->setReferencedColumnName($this->namingStrategy->referenceColumnName());
1001 1001
                 }
1002 1002
 
1003 1003
                 $referencedColumnName = $inverseJoinColumn->getReferencedColumnName();
1004 1004
 
1005
-                if (! $inverseJoinColumn->getColumnName()) {
1005
+                if ( ! $inverseJoinColumn->getColumnName()) {
1006 1006
                     $columnName = $this->namingStrategy->joinKeyColumnName(
1007 1007
                         $property->getTargetEntity(),
1008 1008
                         $referencedColumnName
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
             // Association defined as Id field
1100 1100
             $targetClass = $em->getClassMetadata($property->getTargetEntity());
1101 1101
 
1102
-            if (! $property->isOwningSide()) {
1102
+            if ( ! $property->isOwningSide()) {
1103 1103
                 $property    = $targetClass->getProperty($property->getMappedBy());
1104 1104
                 $targetClass = $em->getClassMetadata($property->getTargetEntity());
1105 1105
             }
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
                 $columnName           = $joinColumn->getColumnName();
1115 1115
                 $referencedColumnName = $joinColumn->getReferencedColumnName();
1116 1116
 
1117
-                if (! $joinColumn->getType()) {
1117
+                if ( ! $joinColumn->getType()) {
1118 1118
                     $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $em));
1119 1119
                 }
1120 1120
 
@@ -1154,11 +1154,11 @@  discard block
 block discarded – undo
1154 1154
     {
1155 1155
         $schema = null === $this->getSchemaName()
1156 1156
             ? ''
1157
-            : $this->getSchemaName() . '_'
1157
+            : $this->getSchemaName().'_'
1158 1158
         ;
1159 1159
 
1160 1160
         // replace dots with underscores because PostgreSQL creates temporary tables in a special schema
1161
-        return $schema . $this->getTableName() . '_id_tmp';
1161
+        return $schema.$this->getTableName().'_id_tmp';
1162 1162
     }
1163 1163
 
1164 1164
     /**
@@ -1218,7 +1218,7 @@  discard block
 block discarded – undo
1218 1218
     {
1219 1219
         $fieldName = $property->getName();
1220 1220
 
1221
-        if (! isset($this->declaredProperties[$fieldName])) {
1221
+        if ( ! isset($this->declaredProperties[$fieldName])) {
1222 1222
             throw MappingException::invalidOverrideFieldName($this->className, $fieldName);
1223 1223
         }
1224 1224
 
@@ -1426,7 +1426,7 @@  discard block
 block discarded – undo
1426 1426
         $declaringClass    = $property->getDeclaringClass();
1427 1427
 
1428 1428
         if ($inheritedProperty instanceof FieldMetadata) {
1429
-            if (! $declaringClass->isMappedSuperclass) {
1429
+            if ( ! $declaringClass->isMappedSuperclass) {
1430 1430
                 $inheritedProperty->setTableName($property->getTableName());
1431 1431
             }
1432 1432
 
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
             throw MappingException::duplicateQueryMapping($this->className, $name);
1495 1495
         }
1496 1496
 
1497
-        if (! isset($queryMapping['resultClass']) && ! isset($queryMapping['resultSetMapping'])) {
1497
+        if ( ! isset($queryMapping['resultClass']) && ! isset($queryMapping['resultSetMapping'])) {
1498 1498
             throw MappingException::missingQueryMapping($this->className, $name);
1499 1499
         }
1500 1500
 
@@ -1517,7 +1517,7 @@  discard block
 block discarded – undo
1517 1517
      */
1518 1518
     public function addSqlResultSetMapping(array $resultMapping)
1519 1519
     {
1520
-        if (!isset($resultMapping['name'])) {
1520
+        if ( ! isset($resultMapping['name'])) {
1521 1521
             throw MappingException::nameIsMandatoryForSqlResultSetMapping($this->className);
1522 1522
         }
1523 1523
 
@@ -1527,7 +1527,7 @@  discard block
 block discarded – undo
1527 1527
 
1528 1528
         if (isset($resultMapping['entities'])) {
1529 1529
             foreach ($resultMapping['entities'] as $key => $entityResult) {
1530
-                if (! isset($entityResult['entityClass'])) {
1530
+                if ( ! isset($entityResult['entityClass'])) {
1531 1531
                     throw MappingException::missingResultSetMappingEntity($this->className, $resultMapping['name']);
1532 1532
                 }
1533 1533
 
@@ -1540,11 +1540,11 @@  discard block
 block discarded – undo
1540 1540
 
1541 1541
                 if (isset($entityResult['fields'])) {
1542 1542
                     foreach ($entityResult['fields'] as $k => $field) {
1543
-                        if (! isset($field['name'])) {
1543
+                        if ( ! isset($field['name'])) {
1544 1544
                             throw MappingException::missingResultSetMappingFieldName($this->className, $resultMapping['name']);
1545 1545
                         }
1546 1546
 
1547
-                        if (! isset($field['column'])) {
1547
+                        if ( ! isset($field['column'])) {
1548 1548
                             $fieldName = $field['name'];
1549 1549
 
1550 1550
                             if (strpos($fieldName, '.')) {
@@ -1653,11 +1653,11 @@  discard block
 block discarded – undo
1653 1653
             'method' => $method,
1654 1654
         ];
1655 1655
 
1656
-        if (! class_exists($class)) {
1656
+        if ( ! class_exists($class)) {
1657 1657
             throw MappingException::entityListenerClassNotFound($class, $this->className);
1658 1658
         }
1659 1659
 
1660
-        if (! method_exists($class, $method)) {
1660
+        if ( ! method_exists($class, $method)) {
1661 1661
             throw MappingException::entityListenerMethodNotFound($class, $method, $this->className);
1662 1662
         }
1663 1663
 
@@ -1733,7 +1733,7 @@  discard block
 block discarded – undo
1733 1733
             return;
1734 1734
         }
1735 1735
 
1736
-        if (! (class_exists($className) || interface_exists($className))) {
1736
+        if ( ! (class_exists($className) || interface_exists($className))) {
1737 1737
             throw MappingException::invalidClassInDiscriminatorMap($className, $this->className);
1738 1738
         }
1739 1739
 
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/Driver/DriverChain.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  * <http://www.doctrine-project.org>.
19 19
  */
20 20
 
21
-declare(strict_types=1);
21
+declare(strict_types = 1);
22 22
 
23 23
 namespace Doctrine\ORM\Mapping\Driver;
24 24
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         foreach ($this->drivers AS $namespace => $driver) {
131 131
             $oid = spl_object_id($driver);
132 132
 
133
-            if (!isset($driverClasses[$oid])) {
133
+            if ( ! isset($driverClasses[$oid])) {
134 134
                 $driverClasses[$oid] = $driver->getAllClassNames();
135 135
             }
136 136
 
Please login to merge, or discard this patch.