Failed Conditions
Pull Request — 2.8.x (#8083)
by
unknown
61:51
created
lib/Doctrine/ORM/UnitOfWork.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2848,8 +2848,8 @@
 block discarded – undo
2848 2848
                     $this->originalEntityData[$oid][$field] = $newValue;
2849 2849
                     $class->reflFields[$field]->setValue($entity, $newValue);
2850 2850
 
2851
-		    if ($assoc['inversedBy'] && $assoc['type'] && ClassMetadata::ONE_TO_ONE  &&
2852
-			    isset($targetClass->associationMappings[$assoc['inversedBy']])) {
2851
+            if ($assoc['inversedBy'] && $assoc['type'] && ClassMetadata::ONE_TO_ONE  &&
2852
+                isset($targetClass->associationMappings[$assoc['inversedBy']])) {
2853 2853
 
2854 2854
                         $inverseAssoc = $targetClass->associationMappings[$assoc['inversedBy']];
2855 2855
                         $targetClass->reflFields[$inverseAssoc['fieldName']]->setValue($newValue, $entity);
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
         try {
383 383
             // Collection deletions (deletions of complete collections)
384 384
             foreach ($this->collectionDeletions as $collectionToDelete) {
385
-                if (! $collectionToDelete instanceof PersistentCollection) {
385
+                if ( ! $collectionToDelete instanceof PersistentCollection) {
386 386
                     $this->getCollectionPersister($collectionToDelete->getMapping())->delete($collectionToDelete);
387 387
 
388 388
                     continue;
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
         $state = $this->getEntityState($entity);
523 523
 
524 524
         if ($state !== self::STATE_MANAGED && $state !== self::STATE_REMOVED) {
525
-            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation " . self::objToStr($entity));
525
+            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation ".self::objToStr($entity));
526 526
         }
527 527
 
528 528
         $class = $this->em->getClassMetadata(get_class($entity));
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
         $oid  = spl_object_hash($entity);
579 579
         $data = [];
580 580
 
581
-        if (!isset($this->entityChangeSets[$oid])) {
581
+        if ( ! isset($this->entityChangeSets[$oid])) {
582 582
             return $data;
583 583
         }
584 584
 
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
                     if ($owner === null) { // cloned
742 742
                         $actualValue->setOwner($entity, $assoc);
743 743
                     } else if ($owner !== $entity) { // no clone, we have to fix
744
-                        if (!$actualValue->isInitialized()) {
744
+                        if ( ! $actualValue->isInitialized()) {
745 745
                             $actualValue->initialize(); // we have to do this otherwise the cols share state
746 746
                         }
747 747
                         $newValue = clone $actualValue;
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
         $targetClass    = $this->em->getClassMetadata($assoc['targetEntity']);
888 888
 
889 889
         foreach ($unwrappedValue as $key => $entry) {
890
-            if (! ($entry instanceof $targetClass->name)) {
890
+            if ( ! ($entry instanceof $targetClass->name)) {
891 891
                 throw ORMInvalidArgumentException::invalidAssociation($targetClass, $assoc, $entry);
892 892
             }
893 893
 
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
 
966 966
             // Some identifiers may be foreign keys to new entities.
967 967
             // In this case, we don't have the value yet and should treat it as if we have a post-insert generator
968
-            if (! $this->hasMissingIdsWhichAreForeignKeys($class, $idValue)) {
968
+            if ( ! $this->hasMissingIdsWhichAreForeignKeys($class, $idValue)) {
969 969
                 $this->entityIdentifiers[$oid] = $idValue;
970 970
             }
971 971
         }
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
             }
1115 1115
         } else {
1116 1116
             foreach ($insertionsForClass as $oid => $entity) {
1117
-                if (! isset($this->entityIdentifiers[$oid])) {
1117
+                if ( ! isset($this->entityIdentifiers[$oid])) {
1118 1118
                     //entity was not added to identity map because some identifiers are foreign keys to new entities.
1119 1119
                     //add it now
1120 1120
                     $this->addToEntityIdentifiersAndEntityMap($class, $oid, $entity);
@@ -1279,7 +1279,7 @@  discard block
 block discarded – undo
1279 1279
 
1280 1280
                 $joinColumns = reset($assoc['joinColumns']);
1281 1281
 
1282
-                $calc->addDependency($targetClass->name, $class->name, (int)empty($joinColumns['nullable']));
1282
+                $calc->addDependency($targetClass->name, $class->name, (int) empty($joinColumns['nullable']));
1283 1283
 
1284 1284
                 // If the target class has mapped subclasses, these share the same dependency.
1285 1285
                 if ( ! $targetClass->subClasses) {
@@ -1802,7 +1802,7 @@  discard block
 block discarded – undo
1802 1802
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "persisted");
1803 1803
 
1804 1804
             default:
1805
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1805
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1806 1806
         }
1807 1807
 
1808 1808
         $this->cascadePersist($entity, $visited);
@@ -1872,7 +1872,7 @@  discard block
 block discarded – undo
1872 1872
             case self::STATE_DETACHED:
1873 1873
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "removed");
1874 1874
             default:
1875
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1875
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1876 1876
         }
1877 1877
 
1878 1878
     }
@@ -2011,7 +2011,7 @@  discard block
 block discarded – undo
2011 2011
      */
2012 2012
     private function ensureVersionMatch(ClassMetadata $class, $entity, $managedCopy)
2013 2013
     {
2014
-        if (! ($class->isVersioned && $this->isLoaded($managedCopy) && $this->isLoaded($entity))) {
2014
+        if ( ! ($class->isVersioned && $this->isLoaded($managedCopy) && $this->isLoaded($entity))) {
2015 2015
             return;
2016 2016
         }
2017 2017
 
@@ -2036,7 +2036,7 @@  discard block
 block discarded – undo
2036 2036
      */
2037 2037
     private function isLoaded($entity)
2038 2038
     {
2039
-        return !($entity instanceof Proxy) || $entity->__isInitialized();
2039
+        return ! ($entity instanceof Proxy) || $entity->__isInitialized();
2040 2040
     }
2041 2041
 
2042 2042
     /**
@@ -2196,7 +2196,7 @@  discard block
 block discarded – undo
2196 2196
 
2197 2197
         $associationMappings = array_filter(
2198 2198
             $class->associationMappings,
2199
-            function ($assoc) { return $assoc['isCascadeRefresh']; }
2199
+            function($assoc) { return $assoc['isCascadeRefresh']; }
2200 2200
         );
2201 2201
 
2202 2202
         foreach ($associationMappings as $assoc) {
@@ -2239,7 +2239,7 @@  discard block
 block discarded – undo
2239 2239
 
2240 2240
         $associationMappings = array_filter(
2241 2241
             $class->associationMappings,
2242
-            function ($assoc) { return $assoc['isCascadeDetach']; }
2242
+            function($assoc) { return $assoc['isCascadeDetach']; }
2243 2243
         );
2244 2244
 
2245 2245
         foreach ($associationMappings as $assoc) {
@@ -2283,7 +2283,7 @@  discard block
 block discarded – undo
2283 2283
 
2284 2284
         $associationMappings = array_filter(
2285 2285
             $class->associationMappings,
2286
-            function ($assoc) { return $assoc['isCascadeMerge']; }
2286
+            function($assoc) { return $assoc['isCascadeMerge']; }
2287 2287
         );
2288 2288
 
2289 2289
         foreach ($associationMappings as $assoc) {
@@ -2322,7 +2322,7 @@  discard block
 block discarded – undo
2322 2322
 
2323 2323
         $associationMappings = array_filter(
2324 2324
             $class->associationMappings,
2325
-            function ($assoc) { return $assoc['isCascadePersist']; }
2325
+            function($assoc) { return $assoc['isCascadePersist']; }
2326 2326
         );
2327 2327
 
2328 2328
         foreach ($associationMappings as $assoc) {
@@ -2351,7 +2351,7 @@  discard block
 block discarded – undo
2351 2351
                     break;
2352 2352
 
2353 2353
                 case ($relatedEntities !== null):
2354
-                    if (! $relatedEntities instanceof $assoc['targetEntity']) {
2354
+                    if ( ! $relatedEntities instanceof $assoc['targetEntity']) {
2355 2355
                         throw ORMInvalidArgumentException::invalidAssociation(
2356 2356
                             $this->em->getClassMetadata($assoc['targetEntity']),
2357 2357
                             $assoc,
@@ -2382,13 +2382,13 @@  discard block
 block discarded – undo
2382 2382
 
2383 2383
         $associationMappings = array_filter(
2384 2384
             $class->associationMappings,
2385
-            function ($assoc) { return $assoc['isCascadeRemove']; }
2385
+            function($assoc) { return $assoc['isCascadeRemove']; }
2386 2386
         );
2387 2387
 
2388 2388
         $entitiesToCascade = [];
2389 2389
 
2390 2390
         foreach ($associationMappings as $assoc) {
2391
-            if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2391
+            if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2392 2392
                 $entity->__load();
2393 2393
             }
2394 2394
 
@@ -2452,7 +2452,7 @@  discard block
 block discarded – undo
2452 2452
                     return;
2453 2453
                 }
2454 2454
 
2455
-                if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2455
+                if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2456 2456
                     $entity->__load();
2457 2457
                 }
2458 2458
 
@@ -2467,7 +2467,7 @@  discard block
 block discarded – undo
2467 2467
             case LockMode::NONE === $lockMode:
2468 2468
             case LockMode::PESSIMISTIC_READ === $lockMode:
2469 2469
             case LockMode::PESSIMISTIC_WRITE === $lockMode:
2470
-                if (!$this->em->getConnection()->isTransactionActive()) {
2470
+                if ( ! $this->em->getConnection()->isTransactionActive()) {
2471 2471
                     throw TransactionRequiredException::transactionRequired();
2472 2472
                 }
2473 2473
 
@@ -2792,7 +2792,7 @@  discard block
 block discarded – undo
2792 2792
                             // then we can append this entity for eager loading!
2793 2793
                             if ($hints['fetchMode'][$class->name][$field] == ClassMetadata::FETCH_EAGER &&
2794 2794
                                 isset($hints[self::HINT_DEFEREAGERLOAD]) &&
2795
-                                !$targetClass->isIdentifierComposite &&
2795
+                                ! $targetClass->isIdentifierComposite &&
2796 2796
                                 $newValue instanceof Proxy &&
2797 2797
                                 $newValue->__isInitialized__ === false) {
2798 2798
 
@@ -2848,7 +2848,7 @@  discard block
 block discarded – undo
2848 2848
                     $this->originalEntityData[$oid][$field] = $newValue;
2849 2849
                     $class->reflFields[$field]->setValue($entity, $newValue);
2850 2850
 
2851
-		    if ($assoc['inversedBy'] && $assoc['type'] && ClassMetadata::ONE_TO_ONE  &&
2851
+		    if ($assoc['inversedBy'] && $assoc['type'] && ClassMetadata::ONE_TO_ONE &&
2852 2852
 			    isset($targetClass->associationMappings[$assoc['inversedBy']])) {
2853 2853
 
2854 2854
                         $inverseAssoc = $targetClass->associationMappings[$assoc['inversedBy']];
@@ -3159,7 +3159,7 @@  discard block
 block discarded – undo
3159 3159
     public function getCollectionPersister(array $association)
3160 3160
     {
3161 3161
         $role = isset($association['cache'])
3162
-            ? $association['sourceEntity'] . '::' . $association['fieldName']
3162
+            ? $association['sourceEntity'].'::'.$association['fieldName']
3163 3163
             : $association['type'];
3164 3164
 
3165 3165
         if (isset($this->collectionPersisters[$role])) {
@@ -3377,7 +3377,7 @@  discard block
 block discarded – undo
3377 3377
      */
3378 3378
     private function afterTransactionComplete()
3379 3379
     {
3380
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3380
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3381 3381
             $persister->afterTransactionComplete();
3382 3382
         });
3383 3383
     }
@@ -3387,7 +3387,7 @@  discard block
 block discarded – undo
3387 3387
      */
3388 3388
     private function afterTransactionRolledBack()
3389 3389
     {
3390
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3390
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3391 3391
             $persister->afterTransactionRolledBack();
3392 3392
         });
3393 3393
     }
@@ -3483,11 +3483,11 @@  discard block
 block discarded – undo
3483 3483
      */
3484 3484
     private function mergeEntityStateIntoManagedCopy($entity, $managedCopy)
3485 3485
     {
3486
-        if (! $this->isLoaded($entity)) {
3486
+        if ( ! $this->isLoaded($entity)) {
3487 3487
             return;
3488 3488
         }
3489 3489
 
3490
-        if (! $this->isLoaded($managedCopy)) {
3490
+        if ( ! $this->isLoaded($managedCopy)) {
3491 3491
             $managedCopy->__load();
3492 3492
         }
3493 3493
 
@@ -3510,7 +3510,7 @@  discard block
 block discarded – undo
3510 3510
                     if ($other === null) {
3511 3511
                         $prop->setValue($managedCopy, null);
3512 3512
                     } else {
3513
-                        if ($other instanceof Proxy && !$other->__isInitialized()) {
3513
+                        if ($other instanceof Proxy && ! $other->__isInitialized()) {
3514 3514
                             // do not merge fields marked lazy that have not been fetched.
3515 3515
                             continue;
3516 3516
                         }
@@ -3597,7 +3597,7 @@  discard block
 block discarded – undo
3597 3597
      */
3598 3598
     private function clearIdentityMapForEntityName($entityName)
3599 3599
     {
3600
-        if (! isset($this->identityMap[$entityName])) {
3600
+        if ( ! isset($this->identityMap[$entityName])) {
3601 3601
             return;
3602 3602
         }
3603 3603
 
Please login to merge, or discard this patch.