Passed
Pull Request — 2.6 (#7003)
by
unknown
10:32
created
lib/Doctrine/ORM/UnitOfWork.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
         $state = $this->getEntityState($entity);
500 500
 
501 501
         if ($state !== self::STATE_MANAGED && $state !== self::STATE_REMOVED) {
502
-            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation " . self::objToStr($entity));
502
+            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation ".self::objToStr($entity));
503 503
         }
504 504
 
505 505
         $class = $this->em->getClassMetadata(get_class($entity));
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
         $oid  = spl_object_hash($entity);
556 556
         $data = [];
557 557
 
558
-        if (!isset($this->entityChangeSets[$oid])) {
558
+        if ( ! isset($this->entityChangeSets[$oid])) {
559 559
             return $data;
560 560
         }
561 561
 
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
                     if ($owner === null) { // cloned
719 719
                         $actualValue->setOwner($entity, $assoc);
720 720
                     } else if ($owner !== $entity) { // no clone, we have to fix
721
-                        if (!$actualValue->isInitialized()) {
721
+                        if ( ! $actualValue->isInitialized()) {
722 722
                             $actualValue->initialize(); // we have to do this otherwise the cols share state
723 723
                         }
724 724
                         $newValue = clone $actualValue;
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
         $targetClass    = $this->em->getClassMetadata($assoc['targetEntity']);
865 865
 
866 866
         foreach ($unwrappedValue as $key => $entry) {
867
-            if (! ($entry instanceof $targetClass->name)) {
867
+            if ( ! ($entry instanceof $targetClass->name)) {
868 868
                 throw ORMInvalidArgumentException::invalidAssociation($targetClass, $assoc, $entry);
869 869
             }
870 870
 
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
 
943 943
             // Some identifiers may be foreign keys to new entities.
944 944
             // In this case, we don't have the value yet and should treat it as if we have a post-insert generator
945
-            if(!$this->hasMissingIdsWhichAreForeignKeys($class, $idValue)) {
945
+            if ( ! $this->hasMissingIdsWhichAreForeignKeys($class, $idValue)) {
946 946
                 $this->entityIdentifiers[$oid] = $idValue;
947 947
             }
948 948
         }
@@ -954,8 +954,8 @@  discard block
 block discarded – undo
954 954
 
955 955
     private function hasMissingIdsWhichAreForeignKeys(ClassMetadata $class, array $idValue) {
956 956
         $hasMissingIdsWhichAreForeignKeys = false;
957
-        foreach($idValue as $idField => $idFieldValue) {
958
-            if($idFieldValue === null && isset($class->associationMappings[$idField])) {
957
+        foreach ($idValue as $idField => $idFieldValue) {
958
+            if ($idFieldValue === null && isset($class->associationMappings[$idField])) {
959 959
                 $hasMissingIdsWhichAreForeignKeys = true;
960 960
                 break;
961 961
             }
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
             }
1090 1090
         } else {
1091 1091
             foreach ($insertionsForClass as $oid => $entity) {
1092
-                if(!isset($this->entityIdentifiers[$oid])) {
1092
+                if ( ! isset($this->entityIdentifiers[$oid])) {
1093 1093
                     //entity was not added to identity map because some identifiers are foreign keys to new entities.
1094 1094
                     //add it now
1095 1095
                     $this->addToEntityIdentifiersAndEntityMap($class, $oid, $entity);
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
 
1119 1119
         $this->entityIdentifiers[$oid] = $identifier;
1120 1120
 
1121
-        foreach($identifier as $idField => $idValue) {
1121
+        foreach ($identifier as $idField => $idValue) {
1122 1122
             $this->originalEntityData[$oid][$idField] = $idValue;
1123 1123
         }
1124 1124
 
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
 
1255 1255
                 $joinColumns = reset($assoc['joinColumns']);
1256 1256
 
1257
-                $calc->addDependency($targetClass->name, $class->name, (int)empty($joinColumns['nullable']));
1257
+                $calc->addDependency($targetClass->name, $class->name, (int) empty($joinColumns['nullable']));
1258 1258
 
1259 1259
                 // If the target class has mapped subclasses, these share the same dependency.
1260 1260
                 if ( ! $targetClass->subClasses) {
@@ -1777,7 +1777,7 @@  discard block
 block discarded – undo
1777 1777
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "persisted");
1778 1778
 
1779 1779
             default:
1780
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1780
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1781 1781
         }
1782 1782
 
1783 1783
         $this->cascadePersist($entity, $visited);
@@ -1847,7 +1847,7 @@  discard block
 block discarded – undo
1847 1847
             case self::STATE_DETACHED:
1848 1848
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "removed");
1849 1849
             default:
1850
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1850
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1851 1851
         }
1852 1852
 
1853 1853
     }
@@ -1986,7 +1986,7 @@  discard block
 block discarded – undo
1986 1986
      */
1987 1987
     private function ensureVersionMatch(ClassMetadata $class, $entity, $managedCopy)
1988 1988
     {
1989
-        if (! ($class->isVersioned && $this->isLoaded($managedCopy) && $this->isLoaded($entity))) {
1989
+        if ( ! ($class->isVersioned && $this->isLoaded($managedCopy) && $this->isLoaded($entity))) {
1990 1990
             return;
1991 1991
         }
1992 1992
 
@@ -2011,7 +2011,7 @@  discard block
 block discarded – undo
2011 2011
      */
2012 2012
     private function isLoaded($entity)
2013 2013
     {
2014
-        return !($entity instanceof Proxy) || $entity->__isInitialized();
2014
+        return ! ($entity instanceof Proxy) || $entity->__isInitialized();
2015 2015
     }
2016 2016
 
2017 2017
     /**
@@ -2169,7 +2169,7 @@  discard block
 block discarded – undo
2169 2169
 
2170 2170
         $associationMappings = array_filter(
2171 2171
             $class->associationMappings,
2172
-            function ($assoc) { return $assoc['isCascadeRefresh']; }
2172
+            function($assoc) { return $assoc['isCascadeRefresh']; }
2173 2173
         );
2174 2174
 
2175 2175
         foreach ($associationMappings as $assoc) {
@@ -2212,7 +2212,7 @@  discard block
 block discarded – undo
2212 2212
 
2213 2213
         $associationMappings = array_filter(
2214 2214
             $class->associationMappings,
2215
-            function ($assoc) { return $assoc['isCascadeDetach']; }
2215
+            function($assoc) { return $assoc['isCascadeDetach']; }
2216 2216
         );
2217 2217
 
2218 2218
         foreach ($associationMappings as $assoc) {
@@ -2256,7 +2256,7 @@  discard block
 block discarded – undo
2256 2256
 
2257 2257
         $associationMappings = array_filter(
2258 2258
             $class->associationMappings,
2259
-            function ($assoc) { return $assoc['isCascadeMerge']; }
2259
+            function($assoc) { return $assoc['isCascadeMerge']; }
2260 2260
         );
2261 2261
 
2262 2262
         foreach ($associationMappings as $assoc) {
@@ -2295,7 +2295,7 @@  discard block
 block discarded – undo
2295 2295
 
2296 2296
         $associationMappings = array_filter(
2297 2297
             $class->associationMappings,
2298
-            function ($assoc) { return $assoc['isCascadePersist']; }
2298
+            function($assoc) { return $assoc['isCascadePersist']; }
2299 2299
         );
2300 2300
 
2301 2301
         foreach ($associationMappings as $assoc) {
@@ -2324,7 +2324,7 @@  discard block
 block discarded – undo
2324 2324
                     break;
2325 2325
 
2326 2326
                 case ($relatedEntities !== null):
2327
-                    if (! $relatedEntities instanceof $assoc['targetEntity']) {
2327
+                    if ( ! $relatedEntities instanceof $assoc['targetEntity']) {
2328 2328
                         throw ORMInvalidArgumentException::invalidAssociation(
2329 2329
                             $this->em->getClassMetadata($assoc['targetEntity']),
2330 2330
                             $assoc,
@@ -2355,13 +2355,13 @@  discard block
 block discarded – undo
2355 2355
 
2356 2356
         $associationMappings = array_filter(
2357 2357
             $class->associationMappings,
2358
-            function ($assoc) { return $assoc['isCascadeRemove']; }
2358
+            function($assoc) { return $assoc['isCascadeRemove']; }
2359 2359
         );
2360 2360
 
2361 2361
         $entitiesToCascade = [];
2362 2362
 
2363 2363
         foreach ($associationMappings as $assoc) {
2364
-            if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2364
+            if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2365 2365
                 $entity->__load();
2366 2366
             }
2367 2367
 
@@ -2425,7 +2425,7 @@  discard block
 block discarded – undo
2425 2425
                     return;
2426 2426
                 }
2427 2427
 
2428
-                if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2428
+                if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2429 2429
                     $entity->__load();
2430 2430
                 }
2431 2431
 
@@ -2440,7 +2440,7 @@  discard block
 block discarded – undo
2440 2440
             case LockMode::NONE === $lockMode:
2441 2441
             case LockMode::PESSIMISTIC_READ === $lockMode:
2442 2442
             case LockMode::PESSIMISTIC_WRITE === $lockMode:
2443
-                if (!$this->em->getConnection()->isTransactionActive()) {
2443
+                if ( ! $this->em->getConnection()->isTransactionActive()) {
2444 2444
                     throw TransactionRequiredException::transactionRequired();
2445 2445
                 }
2446 2446
 
@@ -2764,7 +2764,7 @@  discard block
 block discarded – undo
2764 2764
                             // then we can append this entity for eager loading!
2765 2765
                             if ($hints['fetchMode'][$class->name][$field] == ClassMetadata::FETCH_EAGER &&
2766 2766
                                 isset($hints[self::HINT_DEFEREAGERLOAD]) &&
2767
-                                !$targetClass->isIdentifierComposite &&
2767
+                                ! $targetClass->isIdentifierComposite &&
2768 2768
                                 $newValue instanceof Proxy &&
2769 2769
                                 $newValue->__isInitialized__ === false) {
2770 2770
 
@@ -3129,7 +3129,7 @@  discard block
 block discarded – undo
3129 3129
     public function getCollectionPersister(array $association)
3130 3130
     {
3131 3131
         $role = isset($association['cache'])
3132
-            ? $association['sourceEntity'] . '::' . $association['fieldName']
3132
+            ? $association['sourceEntity'].'::'.$association['fieldName']
3133 3133
             : $association['type'];
3134 3134
 
3135 3135
         if (isset($this->collectionPersisters[$role])) {
@@ -3347,7 +3347,7 @@  discard block
 block discarded – undo
3347 3347
      */
3348 3348
     private function afterTransactionComplete()
3349 3349
     {
3350
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3350
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3351 3351
             $persister->afterTransactionComplete();
3352 3352
         });
3353 3353
     }
@@ -3357,7 +3357,7 @@  discard block
 block discarded – undo
3357 3357
      */
3358 3358
     private function afterTransactionRolledBack()
3359 3359
     {
3360
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3360
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3361 3361
             $persister->afterTransactionRolledBack();
3362 3362
         });
3363 3363
     }
@@ -3453,11 +3453,11 @@  discard block
 block discarded – undo
3453 3453
      */
3454 3454
     private function mergeEntityStateIntoManagedCopy($entity, $managedCopy)
3455 3455
     {
3456
-        if (! $this->isLoaded($entity)) {
3456
+        if ( ! $this->isLoaded($entity)) {
3457 3457
             return;
3458 3458
         }
3459 3459
 
3460
-        if (! $this->isLoaded($managedCopy)) {
3460
+        if ( ! $this->isLoaded($managedCopy)) {
3461 3461
             $managedCopy->__load();
3462 3462
         }
3463 3463
 
@@ -3480,7 +3480,7 @@  discard block
 block discarded – undo
3480 3480
                     if ($other === null) {
3481 3481
                         $prop->setValue($managedCopy, null);
3482 3482
                     } else {
3483
-                        if ($other instanceof Proxy && !$other->__isInitialized()) {
3483
+                        if ($other instanceof Proxy && ! $other->__isInitialized()) {
3484 3484
                             // do not merge fields marked lazy that have not been fetched.
3485 3485
                             continue;
3486 3486
                         }
@@ -3567,7 +3567,7 @@  discard block
 block discarded – undo
3567 3567
      */
3568 3568
     private function clearIdentityMapForEntityName($entityName)
3569 3569
     {
3570
-        if (! isset($this->identityMap[$entityName])) {
3570
+        if ( ! isset($this->identityMap[$entityName])) {
3571 3571
             return;
3572 3572
         }
3573 3573
 
Please login to merge, or discard this patch.