Failed Conditions
Pull Request — 2.7 (#8065)
by
unknown
07:43
created
lib/Doctrine/ORM/UnitOfWork.php 1 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;
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
         $state = $this->getEntityState($entity);
515 515
 
516 516
         if ($state !== self::STATE_MANAGED && $state !== self::STATE_REMOVED) {
517
-            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation " . self::objToStr($entity));
517
+            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation ".self::objToStr($entity));
518 518
         }
519 519
 
520 520
         $class = $this->em->getClassMetadata(get_class($entity));
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
         $oid  = spl_object_hash($entity);
571 571
         $data = [];
572 572
 
573
-        if (!isset($this->entityChangeSets[$oid])) {
573
+        if ( ! isset($this->entityChangeSets[$oid])) {
574 574
             return $data;
575 575
         }
576 576
 
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
                     if ($owner === null) { // cloned
734 734
                         $actualValue->setOwner($entity, $assoc);
735 735
                     } else if ($owner !== $entity) { // no clone, we have to fix
736
-                        if (!$actualValue->isInitialized()) {
736
+                        if ( ! $actualValue->isInitialized()) {
737 737
                             $actualValue->initialize(); // we have to do this otherwise the cols share state
738 738
                         }
739 739
                         $newValue = clone $actualValue;
@@ -879,7 +879,7 @@  discard block
 block discarded – undo
879 879
         $targetClass    = $this->em->getClassMetadata($assoc['targetEntity']);
880 880
 
881 881
         foreach ($unwrappedValue as $key => $entry) {
882
-            if (! ($entry instanceof $targetClass->name)) {
882
+            if ( ! ($entry instanceof $targetClass->name)) {
883 883
                 throw ORMInvalidArgumentException::invalidAssociation($targetClass, $assoc, $entry);
884 884
             }
885 885
 
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
 
958 958
             // Some identifiers may be foreign keys to new entities.
959 959
             // In this case, we don't have the value yet and should treat it as if we have a post-insert generator
960
-            if (! $this->hasMissingIdsWhichAreForeignKeys($class, $idValue)) {
960
+            if ( ! $this->hasMissingIdsWhichAreForeignKeys($class, $idValue)) {
961 961
                 $this->entityIdentifiers[$oid] = $idValue;
962 962
             }
963 963
         }
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
             }
1107 1107
         } else {
1108 1108
             foreach ($insertionsForClass as $oid => $entity) {
1109
-                if (! isset($this->entityIdentifiers[$oid])) {
1109
+                if ( ! isset($this->entityIdentifiers[$oid])) {
1110 1110
                     //entity was not added to identity map because some identifiers are foreign keys to new entities.
1111 1111
                     //add it now
1112 1112
                     $this->addToEntityIdentifiersAndEntityMap($class, $oid, $entity);
@@ -1210,7 +1210,7 @@  discard block
 block discarded – undo
1210 1210
             // Entity with this $oid after deletion treated as NEW, even if the $oid
1211 1211
             // is obtained by a new entity because the old one went out of scope.
1212 1212
             //$this->entityStates[$oid] = self::STATE_NEW;
1213
-            if (! $class->isIdentifierNatural()) {
1213
+            if ( ! $class->isIdentifierNatural()) {
1214 1214
                 if (
1215 1215
                     method_exists($class->reflFields[$class->identifier[0]], 'getType') &&
1216 1216
                     $class->reflFields[$class->identifier[0]]->getType() &&
@@ -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
 
@@ -3157,7 +3157,7 @@  discard block
 block discarded – undo
3157 3157
     public function getCollectionPersister(array $association)
3158 3158
     {
3159 3159
         $role = isset($association['cache'])
3160
-            ? $association['sourceEntity'] . '::' . $association['fieldName']
3160
+            ? $association['sourceEntity'].'::'.$association['fieldName']
3161 3161
             : $association['type'];
3162 3162
 
3163 3163
         if (isset($this->collectionPersisters[$role])) {
@@ -3375,7 +3375,7 @@  discard block
 block discarded – undo
3375 3375
      */
3376 3376
     private function afterTransactionComplete()
3377 3377
     {
3378
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3378
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3379 3379
             $persister->afterTransactionComplete();
3380 3380
         });
3381 3381
     }
@@ -3385,7 +3385,7 @@  discard block
 block discarded – undo
3385 3385
      */
3386 3386
     private function afterTransactionRolledBack()
3387 3387
     {
3388
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3388
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3389 3389
             $persister->afterTransactionRolledBack();
3390 3390
         });
3391 3391
     }
@@ -3481,11 +3481,11 @@  discard block
 block discarded – undo
3481 3481
      */
3482 3482
     private function mergeEntityStateIntoManagedCopy($entity, $managedCopy)
3483 3483
     {
3484
-        if (! $this->isLoaded($entity)) {
3484
+        if ( ! $this->isLoaded($entity)) {
3485 3485
             return;
3486 3486
         }
3487 3487
 
3488
-        if (! $this->isLoaded($managedCopy)) {
3488
+        if ( ! $this->isLoaded($managedCopy)) {
3489 3489
             $managedCopy->__load();
3490 3490
         }
3491 3491
 
@@ -3508,7 +3508,7 @@  discard block
 block discarded – undo
3508 3508
                     if ($other === null) {
3509 3509
                         $prop->setValue($managedCopy, null);
3510 3510
                     } else {
3511
-                        if ($other instanceof Proxy && !$other->__isInitialized()) {
3511
+                        if ($other instanceof Proxy && ! $other->__isInitialized()) {
3512 3512
                             // do not merge fields marked lazy that have not been fetched.
3513 3513
                             continue;
3514 3514
                         }
@@ -3595,7 +3595,7 @@  discard block
 block discarded – undo
3595 3595
      */
3596 3596
     private function clearIdentityMapForEntityName($entityName)
3597 3597
     {
3598
-        if (! isset($this->identityMap[$entityName])) {
3598
+        if ( ! isset($this->identityMap[$entityName])) {
3599 3599
             return;
3600 3600
         }
3601 3601
 
Please login to merge, or discard this patch.