Failed Conditions
Pull Request — 2.7 (#8065)
by
unknown
12:21
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 (method_exists($class->reflFields[$class->identifier[0]], 'getType') &&
1215 1215
                     $class->reflFields[$class->identifier[0]]->getType() &&
1216 1216
                     ! $class->reflFields[$class->identifier[0]]->getType()->allowsNull()
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
 
1279 1279
                 $joinColumns = reset($assoc['joinColumns']);
1280 1280
 
1281
-                $calc->addDependency($targetClass->name, $class->name, (int)empty($joinColumns['nullable']));
1281
+                $calc->addDependency($targetClass->name, $class->name, (int) empty($joinColumns['nullable']));
1282 1282
 
1283 1283
                 // If the target class has mapped subclasses, these share the same dependency.
1284 1284
                 if ( ! $targetClass->subClasses) {
@@ -1801,7 +1801,7 @@  discard block
 block discarded – undo
1801 1801
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "persisted");
1802 1802
 
1803 1803
             default:
1804
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1804
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1805 1805
         }
1806 1806
 
1807 1807
         $this->cascadePersist($entity, $visited);
@@ -1871,7 +1871,7 @@  discard block
 block discarded – undo
1871 1871
             case self::STATE_DETACHED:
1872 1872
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "removed");
1873 1873
             default:
1874
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1874
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1875 1875
         }
1876 1876
 
1877 1877
     }
@@ -2010,7 +2010,7 @@  discard block
 block discarded – undo
2010 2010
      */
2011 2011
     private function ensureVersionMatch(ClassMetadata $class, $entity, $managedCopy)
2012 2012
     {
2013
-        if (! ($class->isVersioned && $this->isLoaded($managedCopy) && $this->isLoaded($entity))) {
2013
+        if ( ! ($class->isVersioned && $this->isLoaded($managedCopy) && $this->isLoaded($entity))) {
2014 2014
             return;
2015 2015
         }
2016 2016
 
@@ -2035,7 +2035,7 @@  discard block
 block discarded – undo
2035 2035
      */
2036 2036
     private function isLoaded($entity)
2037 2037
     {
2038
-        return !($entity instanceof Proxy) || $entity->__isInitialized();
2038
+        return ! ($entity instanceof Proxy) || $entity->__isInitialized();
2039 2039
     }
2040 2040
 
2041 2041
     /**
@@ -2195,7 +2195,7 @@  discard block
 block discarded – undo
2195 2195
 
2196 2196
         $associationMappings = array_filter(
2197 2197
             $class->associationMappings,
2198
-            function ($assoc) { return $assoc['isCascadeRefresh']; }
2198
+            function($assoc) { return $assoc['isCascadeRefresh']; }
2199 2199
         );
2200 2200
 
2201 2201
         foreach ($associationMappings as $assoc) {
@@ -2238,7 +2238,7 @@  discard block
 block discarded – undo
2238 2238
 
2239 2239
         $associationMappings = array_filter(
2240 2240
             $class->associationMappings,
2241
-            function ($assoc) { return $assoc['isCascadeDetach']; }
2241
+            function($assoc) { return $assoc['isCascadeDetach']; }
2242 2242
         );
2243 2243
 
2244 2244
         foreach ($associationMappings as $assoc) {
@@ -2282,7 +2282,7 @@  discard block
 block discarded – undo
2282 2282
 
2283 2283
         $associationMappings = array_filter(
2284 2284
             $class->associationMappings,
2285
-            function ($assoc) { return $assoc['isCascadeMerge']; }
2285
+            function($assoc) { return $assoc['isCascadeMerge']; }
2286 2286
         );
2287 2287
 
2288 2288
         foreach ($associationMappings as $assoc) {
@@ -2321,7 +2321,7 @@  discard block
 block discarded – undo
2321 2321
 
2322 2322
         $associationMappings = array_filter(
2323 2323
             $class->associationMappings,
2324
-            function ($assoc) { return $assoc['isCascadePersist']; }
2324
+            function($assoc) { return $assoc['isCascadePersist']; }
2325 2325
         );
2326 2326
 
2327 2327
         foreach ($associationMappings as $assoc) {
@@ -2350,7 +2350,7 @@  discard block
 block discarded – undo
2350 2350
                     break;
2351 2351
 
2352 2352
                 case ($relatedEntities !== null):
2353
-                    if (! $relatedEntities instanceof $assoc['targetEntity']) {
2353
+                    if ( ! $relatedEntities instanceof $assoc['targetEntity']) {
2354 2354
                         throw ORMInvalidArgumentException::invalidAssociation(
2355 2355
                             $this->em->getClassMetadata($assoc['targetEntity']),
2356 2356
                             $assoc,
@@ -2381,13 +2381,13 @@  discard block
 block discarded – undo
2381 2381
 
2382 2382
         $associationMappings = array_filter(
2383 2383
             $class->associationMappings,
2384
-            function ($assoc) { return $assoc['isCascadeRemove']; }
2384
+            function($assoc) { return $assoc['isCascadeRemove']; }
2385 2385
         );
2386 2386
 
2387 2387
         $entitiesToCascade = [];
2388 2388
 
2389 2389
         foreach ($associationMappings as $assoc) {
2390
-            if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2390
+            if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2391 2391
                 $entity->__load();
2392 2392
             }
2393 2393
 
@@ -2451,7 +2451,7 @@  discard block
 block discarded – undo
2451 2451
                     return;
2452 2452
                 }
2453 2453
 
2454
-                if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2454
+                if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2455 2455
                     $entity->__load();
2456 2456
                 }
2457 2457
 
@@ -2466,7 +2466,7 @@  discard block
 block discarded – undo
2466 2466
             case LockMode::NONE === $lockMode:
2467 2467
             case LockMode::PESSIMISTIC_READ === $lockMode:
2468 2468
             case LockMode::PESSIMISTIC_WRITE === $lockMode:
2469
-                if (!$this->em->getConnection()->isTransactionActive()) {
2469
+                if ( ! $this->em->getConnection()->isTransactionActive()) {
2470 2470
                     throw TransactionRequiredException::transactionRequired();
2471 2471
                 }
2472 2472
 
@@ -2791,7 +2791,7 @@  discard block
 block discarded – undo
2791 2791
                             // then we can append this entity for eager loading!
2792 2792
                             if ($hints['fetchMode'][$class->name][$field] == ClassMetadata::FETCH_EAGER &&
2793 2793
                                 isset($hints[self::HINT_DEFEREAGERLOAD]) &&
2794
-                                !$targetClass->isIdentifierComposite &&
2794
+                                ! $targetClass->isIdentifierComposite &&
2795 2795
                                 $newValue instanceof Proxy &&
2796 2796
                                 $newValue->__isInitialized__ === false) {
2797 2797
 
@@ -3156,7 +3156,7 @@  discard block
 block discarded – undo
3156 3156
     public function getCollectionPersister(array $association)
3157 3157
     {
3158 3158
         $role = isset($association['cache'])
3159
-            ? $association['sourceEntity'] . '::' . $association['fieldName']
3159
+            ? $association['sourceEntity'].'::'.$association['fieldName']
3160 3160
             : $association['type'];
3161 3161
 
3162 3162
         if (isset($this->collectionPersisters[$role])) {
@@ -3374,7 +3374,7 @@  discard block
 block discarded – undo
3374 3374
      */
3375 3375
     private function afterTransactionComplete()
3376 3376
     {
3377
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3377
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3378 3378
             $persister->afterTransactionComplete();
3379 3379
         });
3380 3380
     }
@@ -3384,7 +3384,7 @@  discard block
 block discarded – undo
3384 3384
      */
3385 3385
     private function afterTransactionRolledBack()
3386 3386
     {
3387
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3387
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3388 3388
             $persister->afterTransactionRolledBack();
3389 3389
         });
3390 3390
     }
@@ -3480,11 +3480,11 @@  discard block
 block discarded – undo
3480 3480
      */
3481 3481
     private function mergeEntityStateIntoManagedCopy($entity, $managedCopy)
3482 3482
     {
3483
-        if (! $this->isLoaded($entity)) {
3483
+        if ( ! $this->isLoaded($entity)) {
3484 3484
             return;
3485 3485
         }
3486 3486
 
3487
-        if (! $this->isLoaded($managedCopy)) {
3487
+        if ( ! $this->isLoaded($managedCopy)) {
3488 3488
             $managedCopy->__load();
3489 3489
         }
3490 3490
 
@@ -3507,7 +3507,7 @@  discard block
 block discarded – undo
3507 3507
                     if ($other === null) {
3508 3508
                         $prop->setValue($managedCopy, null);
3509 3509
                     } else {
3510
-                        if ($other instanceof Proxy && !$other->__isInitialized()) {
3510
+                        if ($other instanceof Proxy && ! $other->__isInitialized()) {
3511 3511
                             // do not merge fields marked lazy that have not been fetched.
3512 3512
                             continue;
3513 3513
                         }
@@ -3594,7 +3594,7 @@  discard block
 block discarded – undo
3594 3594
      */
3595 3595
     private function clearIdentityMapForEntityName($entityName)
3596 3596
     {
3597
-        if (! isset($this->identityMap[$entityName])) {
3597
+        if ( ! isset($this->identityMap[$entityName])) {
3598 3598
             return;
3599 3599
         }
3600 3600
 
Please login to merge, or discard this patch.