Passed
Pull Request — 2.8.x (#7946)
by
unknown
65:09
created
lib/Doctrine/ORM/UnitOfWork.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
         try {
382 382
             // Collection deletions (deletions of complete collections)
383 383
             foreach ($this->collectionDeletions as $collectionToDelete) {
384
-                if (! $collectionToDelete instanceof PersistentCollection) {
384
+                if ( ! $collectionToDelete instanceof PersistentCollection) {
385 385
                     $this->getCollectionPersister($collectionToDelete->getMapping())->delete($collectionToDelete);
386 386
 
387 387
                     continue;
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
             }
426 426
 
427 427
             // Commit failed silently
428
-            if (!$conn->commit()) {
428
+            if ( ! $conn->commit()) {
429 429
                 throw new OptimisticLockException('Commit failed', $entity);
430 430
             }
431 431
         } catch (Throwable $e) {
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
         $state = $this->getEntityState($entity);
520 520
 
521 521
         if ($state !== self::STATE_MANAGED && $state !== self::STATE_REMOVED) {
522
-            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation " . self::objToStr($entity));
522
+            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation ".self::objToStr($entity));
523 523
         }
524 524
 
525 525
         $class = $this->em->getClassMetadata(get_class($entity));
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
         $oid  = spl_object_hash($entity);
576 576
         $data = [];
577 577
 
578
-        if (!isset($this->entityChangeSets[$oid])) {
578
+        if ( ! isset($this->entityChangeSets[$oid])) {
579 579
             return $data;
580 580
         }
581 581
 
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
                     if ($owner === null) { // cloned
739 739
                         $actualValue->setOwner($entity, $assoc);
740 740
                     } else if ($owner !== $entity) { // no clone, we have to fix
741
-                        if (!$actualValue->isInitialized()) {
741
+                        if ( ! $actualValue->isInitialized()) {
742 742
                             $actualValue->initialize(); // we have to do this otherwise the cols share state
743 743
                         }
744 744
                         $newValue = clone $actualValue;
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
         $targetClass    = $this->em->getClassMetadata($assoc['targetEntity']);
885 885
 
886 886
         foreach ($unwrappedValue as $key => $entry) {
887
-            if (! ($entry instanceof $targetClass->name)) {
887
+            if ( ! ($entry instanceof $targetClass->name)) {
888 888
                 throw ORMInvalidArgumentException::invalidAssociation($targetClass, $assoc, $entry);
889 889
             }
890 890
 
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
 
963 963
             // Some identifiers may be foreign keys to new entities.
964 964
             // In this case, we don't have the value yet and should treat it as if we have a post-insert generator
965
-            if (! $this->hasMissingIdsWhichAreForeignKeys($class, $idValue)) {
965
+            if ( ! $this->hasMissingIdsWhichAreForeignKeys($class, $idValue)) {
966 966
                 $this->entityIdentifiers[$oid] = $idValue;
967 967
             }
968 968
         }
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
             }
1112 1112
         } else {
1113 1113
             foreach ($insertionsForClass as $oid => $entity) {
1114
-                if (! isset($this->entityIdentifiers[$oid])) {
1114
+                if ( ! isset($this->entityIdentifiers[$oid])) {
1115 1115
                     //entity was not added to identity map because some identifiers are foreign keys to new entities.
1116 1116
                     //add it now
1117 1117
                     $this->addToEntityIdentifiersAndEntityMap($class, $oid, $entity);
@@ -1276,7 +1276,7 @@  discard block
 block discarded – undo
1276 1276
 
1277 1277
                 $joinColumns = reset($assoc['joinColumns']);
1278 1278
 
1279
-                $calc->addDependency($targetClass->name, $class->name, (int)empty($joinColumns['nullable']));
1279
+                $calc->addDependency($targetClass->name, $class->name, (int) empty($joinColumns['nullable']));
1280 1280
 
1281 1281
                 // If the target class has mapped subclasses, these share the same dependency.
1282 1282
                 if ( ! $targetClass->subClasses) {
@@ -1799,7 +1799,7 @@  discard block
 block discarded – undo
1799 1799
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "persisted");
1800 1800
 
1801 1801
             default:
1802
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1802
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1803 1803
         }
1804 1804
 
1805 1805
         $this->cascadePersist($entity, $visited);
@@ -1869,7 +1869,7 @@  discard block
 block discarded – undo
1869 1869
             case self::STATE_DETACHED:
1870 1870
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "removed");
1871 1871
             default:
1872
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1872
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1873 1873
         }
1874 1874
 
1875 1875
     }
@@ -2008,7 +2008,7 @@  discard block
 block discarded – undo
2008 2008
      */
2009 2009
     private function ensureVersionMatch(ClassMetadata $class, $entity, $managedCopy)
2010 2010
     {
2011
-        if (! ($class->isVersioned && $this->isLoaded($managedCopy) && $this->isLoaded($entity))) {
2011
+        if ( ! ($class->isVersioned && $this->isLoaded($managedCopy) && $this->isLoaded($entity))) {
2012 2012
             return;
2013 2013
         }
2014 2014
 
@@ -2033,7 +2033,7 @@  discard block
 block discarded – undo
2033 2033
      */
2034 2034
     private function isLoaded($entity)
2035 2035
     {
2036
-        return !($entity instanceof Proxy) || $entity->__isInitialized();
2036
+        return ! ($entity instanceof Proxy) || $entity->__isInitialized();
2037 2037
     }
2038 2038
 
2039 2039
     /**
@@ -2193,7 +2193,7 @@  discard block
 block discarded – undo
2193 2193
 
2194 2194
         $associationMappings = array_filter(
2195 2195
             $class->associationMappings,
2196
-            function ($assoc) { return $assoc['isCascadeRefresh']; }
2196
+            function($assoc) { return $assoc['isCascadeRefresh']; }
2197 2197
         );
2198 2198
 
2199 2199
         foreach ($associationMappings as $assoc) {
@@ -2236,7 +2236,7 @@  discard block
 block discarded – undo
2236 2236
 
2237 2237
         $associationMappings = array_filter(
2238 2238
             $class->associationMappings,
2239
-            function ($assoc) { return $assoc['isCascadeDetach']; }
2239
+            function($assoc) { return $assoc['isCascadeDetach']; }
2240 2240
         );
2241 2241
 
2242 2242
         foreach ($associationMappings as $assoc) {
@@ -2280,7 +2280,7 @@  discard block
 block discarded – undo
2280 2280
 
2281 2281
         $associationMappings = array_filter(
2282 2282
             $class->associationMappings,
2283
-            function ($assoc) { return $assoc['isCascadeMerge']; }
2283
+            function($assoc) { return $assoc['isCascadeMerge']; }
2284 2284
         );
2285 2285
 
2286 2286
         foreach ($associationMappings as $assoc) {
@@ -2319,7 +2319,7 @@  discard block
 block discarded – undo
2319 2319
 
2320 2320
         $associationMappings = array_filter(
2321 2321
             $class->associationMappings,
2322
-            function ($assoc) { return $assoc['isCascadePersist']; }
2322
+            function($assoc) { return $assoc['isCascadePersist']; }
2323 2323
         );
2324 2324
 
2325 2325
         foreach ($associationMappings as $assoc) {
@@ -2348,7 +2348,7 @@  discard block
 block discarded – undo
2348 2348
                     break;
2349 2349
 
2350 2350
                 case ($relatedEntities !== null):
2351
-                    if (! $relatedEntities instanceof $assoc['targetEntity']) {
2351
+                    if ( ! $relatedEntities instanceof $assoc['targetEntity']) {
2352 2352
                         throw ORMInvalidArgumentException::invalidAssociation(
2353 2353
                             $this->em->getClassMetadata($assoc['targetEntity']),
2354 2354
                             $assoc,
@@ -2379,13 +2379,13 @@  discard block
 block discarded – undo
2379 2379
 
2380 2380
         $associationMappings = array_filter(
2381 2381
             $class->associationMappings,
2382
-            function ($assoc) { return $assoc['isCascadeRemove']; }
2382
+            function($assoc) { return $assoc['isCascadeRemove']; }
2383 2383
         );
2384 2384
 
2385 2385
         $entitiesToCascade = [];
2386 2386
 
2387 2387
         foreach ($associationMappings as $assoc) {
2388
-            if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2388
+            if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2389 2389
                 $entity->__load();
2390 2390
             }
2391 2391
 
@@ -2449,7 +2449,7 @@  discard block
 block discarded – undo
2449 2449
                     return;
2450 2450
                 }
2451 2451
 
2452
-                if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2452
+                if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2453 2453
                     $entity->__load();
2454 2454
                 }
2455 2455
 
@@ -2464,7 +2464,7 @@  discard block
 block discarded – undo
2464 2464
             case LockMode::NONE === $lockMode:
2465 2465
             case LockMode::PESSIMISTIC_READ === $lockMode:
2466 2466
             case LockMode::PESSIMISTIC_WRITE === $lockMode:
2467
-                if (!$this->em->getConnection()->isTransactionActive()) {
2467
+                if ( ! $this->em->getConnection()->isTransactionActive()) {
2468 2468
                     throw TransactionRequiredException::transactionRequired();
2469 2469
                 }
2470 2470
 
@@ -2789,7 +2789,7 @@  discard block
 block discarded – undo
2789 2789
                             // then we can append this entity for eager loading!
2790 2790
                             if ($hints['fetchMode'][$class->name][$field] == ClassMetadata::FETCH_EAGER &&
2791 2791
                                 isset($hints[self::HINT_DEFEREAGERLOAD]) &&
2792
-                                !$targetClass->isIdentifierComposite &&
2792
+                                ! $targetClass->isIdentifierComposite &&
2793 2793
                                 $newValue instanceof Proxy &&
2794 2794
                                 $newValue->__isInitialized__ === false) {
2795 2795
 
@@ -3154,7 +3154,7 @@  discard block
 block discarded – undo
3154 3154
     public function getCollectionPersister(array $association)
3155 3155
     {
3156 3156
         $role = isset($association['cache'])
3157
-            ? $association['sourceEntity'] . '::' . $association['fieldName']
3157
+            ? $association['sourceEntity'].'::'.$association['fieldName']
3158 3158
             : $association['type'];
3159 3159
 
3160 3160
         if (isset($this->collectionPersisters[$role])) {
@@ -3372,7 +3372,7 @@  discard block
 block discarded – undo
3372 3372
      */
3373 3373
     private function afterTransactionComplete()
3374 3374
     {
3375
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3375
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3376 3376
             $persister->afterTransactionComplete();
3377 3377
         });
3378 3378
     }
@@ -3382,7 +3382,7 @@  discard block
 block discarded – undo
3382 3382
      */
3383 3383
     private function afterTransactionRolledBack()
3384 3384
     {
3385
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3385
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3386 3386
             $persister->afterTransactionRolledBack();
3387 3387
         });
3388 3388
     }
@@ -3478,11 +3478,11 @@  discard block
 block discarded – undo
3478 3478
      */
3479 3479
     private function mergeEntityStateIntoManagedCopy($entity, $managedCopy)
3480 3480
     {
3481
-        if (! $this->isLoaded($entity)) {
3481
+        if ( ! $this->isLoaded($entity)) {
3482 3482
             return;
3483 3483
         }
3484 3484
 
3485
-        if (! $this->isLoaded($managedCopy)) {
3485
+        if ( ! $this->isLoaded($managedCopy)) {
3486 3486
             $managedCopy->__load();
3487 3487
         }
3488 3488
 
@@ -3505,7 +3505,7 @@  discard block
 block discarded – undo
3505 3505
                     if ($other === null) {
3506 3506
                         $prop->setValue($managedCopy, null);
3507 3507
                     } else {
3508
-                        if ($other instanceof Proxy && !$other->__isInitialized()) {
3508
+                        if ($other instanceof Proxy && ! $other->__isInitialized()) {
3509 3509
                             // do not merge fields marked lazy that have not been fetched.
3510 3510
                             continue;
3511 3511
                         }
@@ -3592,7 +3592,7 @@  discard block
 block discarded – undo
3592 3592
      */
3593 3593
     private function clearIdentityMapForEntityName($entityName)
3594 3594
     {
3595
-        if (! isset($this->identityMap[$entityName])) {
3595
+        if ( ! isset($this->identityMap[$entityName])) {
3596 3596
             return;
3597 3597
         }
3598 3598
 
Please login to merge, or discard this patch.