Failed Conditions
Pull Request — 2.7 (#8065)
by
unknown
07:16
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
                 (
1215 1215
                     ! method_exists($class->reflFields[$class->identifier[0]], 'getType') ||
1216 1216
                     $class->reflFields[$class->identifier[0]]->getType() && $class->reflFields[$class->identifier[0]]->getType()->allowsNull()
@@ -1275,7 +1275,7 @@  discard block
 block discarded – undo
1275 1275
 
1276 1276
                 $joinColumns = reset($assoc['joinColumns']);
1277 1277
 
1278
-                $calc->addDependency($targetClass->name, $class->name, (int)empty($joinColumns['nullable']));
1278
+                $calc->addDependency($targetClass->name, $class->name, (int) empty($joinColumns['nullable']));
1279 1279
 
1280 1280
                 // If the target class has mapped subclasses, these share the same dependency.
1281 1281
                 if ( ! $targetClass->subClasses) {
@@ -1798,7 +1798,7 @@  discard block
 block discarded – undo
1798 1798
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "persisted");
1799 1799
 
1800 1800
             default:
1801
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1801
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1802 1802
         }
1803 1803
 
1804 1804
         $this->cascadePersist($entity, $visited);
@@ -1868,7 +1868,7 @@  discard block
 block discarded – undo
1868 1868
             case self::STATE_DETACHED:
1869 1869
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "removed");
1870 1870
             default:
1871
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1871
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1872 1872
         }
1873 1873
 
1874 1874
     }
@@ -2007,7 +2007,7 @@  discard block
 block discarded – undo
2007 2007
      */
2008 2008
     private function ensureVersionMatch(ClassMetadata $class, $entity, $managedCopy)
2009 2009
     {
2010
-        if (! ($class->isVersioned && $this->isLoaded($managedCopy) && $this->isLoaded($entity))) {
2010
+        if ( ! ($class->isVersioned && $this->isLoaded($managedCopy) && $this->isLoaded($entity))) {
2011 2011
             return;
2012 2012
         }
2013 2013
 
@@ -2032,7 +2032,7 @@  discard block
 block discarded – undo
2032 2032
      */
2033 2033
     private function isLoaded($entity)
2034 2034
     {
2035
-        return !($entity instanceof Proxy) || $entity->__isInitialized();
2035
+        return ! ($entity instanceof Proxy) || $entity->__isInitialized();
2036 2036
     }
2037 2037
 
2038 2038
     /**
@@ -2192,7 +2192,7 @@  discard block
 block discarded – undo
2192 2192
 
2193 2193
         $associationMappings = array_filter(
2194 2194
             $class->associationMappings,
2195
-            function ($assoc) { return $assoc['isCascadeRefresh']; }
2195
+            function($assoc) { return $assoc['isCascadeRefresh']; }
2196 2196
         );
2197 2197
 
2198 2198
         foreach ($associationMappings as $assoc) {
@@ -2235,7 +2235,7 @@  discard block
 block discarded – undo
2235 2235
 
2236 2236
         $associationMappings = array_filter(
2237 2237
             $class->associationMappings,
2238
-            function ($assoc) { return $assoc['isCascadeDetach']; }
2238
+            function($assoc) { return $assoc['isCascadeDetach']; }
2239 2239
         );
2240 2240
 
2241 2241
         foreach ($associationMappings as $assoc) {
@@ -2279,7 +2279,7 @@  discard block
 block discarded – undo
2279 2279
 
2280 2280
         $associationMappings = array_filter(
2281 2281
             $class->associationMappings,
2282
-            function ($assoc) { return $assoc['isCascadeMerge']; }
2282
+            function($assoc) { return $assoc['isCascadeMerge']; }
2283 2283
         );
2284 2284
 
2285 2285
         foreach ($associationMappings as $assoc) {
@@ -2318,7 +2318,7 @@  discard block
 block discarded – undo
2318 2318
 
2319 2319
         $associationMappings = array_filter(
2320 2320
             $class->associationMappings,
2321
-            function ($assoc) { return $assoc['isCascadePersist']; }
2321
+            function($assoc) { return $assoc['isCascadePersist']; }
2322 2322
         );
2323 2323
 
2324 2324
         foreach ($associationMappings as $assoc) {
@@ -2347,7 +2347,7 @@  discard block
 block discarded – undo
2347 2347
                     break;
2348 2348
 
2349 2349
                 case ($relatedEntities !== null):
2350
-                    if (! $relatedEntities instanceof $assoc['targetEntity']) {
2350
+                    if ( ! $relatedEntities instanceof $assoc['targetEntity']) {
2351 2351
                         throw ORMInvalidArgumentException::invalidAssociation(
2352 2352
                             $this->em->getClassMetadata($assoc['targetEntity']),
2353 2353
                             $assoc,
@@ -2378,13 +2378,13 @@  discard block
 block discarded – undo
2378 2378
 
2379 2379
         $associationMappings = array_filter(
2380 2380
             $class->associationMappings,
2381
-            function ($assoc) { return $assoc['isCascadeRemove']; }
2381
+            function($assoc) { return $assoc['isCascadeRemove']; }
2382 2382
         );
2383 2383
 
2384 2384
         $entitiesToCascade = [];
2385 2385
 
2386 2386
         foreach ($associationMappings as $assoc) {
2387
-            if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2387
+            if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2388 2388
                 $entity->__load();
2389 2389
             }
2390 2390
 
@@ -2448,7 +2448,7 @@  discard block
 block discarded – undo
2448 2448
                     return;
2449 2449
                 }
2450 2450
 
2451
-                if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2451
+                if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2452 2452
                     $entity->__load();
2453 2453
                 }
2454 2454
 
@@ -2463,7 +2463,7 @@  discard block
 block discarded – undo
2463 2463
             case LockMode::NONE === $lockMode:
2464 2464
             case LockMode::PESSIMISTIC_READ === $lockMode:
2465 2465
             case LockMode::PESSIMISTIC_WRITE === $lockMode:
2466
-                if (!$this->em->getConnection()->isTransactionActive()) {
2466
+                if ( ! $this->em->getConnection()->isTransactionActive()) {
2467 2467
                     throw TransactionRequiredException::transactionRequired();
2468 2468
                 }
2469 2469
 
@@ -2788,7 +2788,7 @@  discard block
 block discarded – undo
2788 2788
                             // then we can append this entity for eager loading!
2789 2789
                             if ($hints['fetchMode'][$class->name][$field] == ClassMetadata::FETCH_EAGER &&
2790 2790
                                 isset($hints[self::HINT_DEFEREAGERLOAD]) &&
2791
-                                !$targetClass->isIdentifierComposite &&
2791
+                                ! $targetClass->isIdentifierComposite &&
2792 2792
                                 $newValue instanceof Proxy &&
2793 2793
                                 $newValue->__isInitialized__ === false) {
2794 2794
 
@@ -3153,7 +3153,7 @@  discard block
 block discarded – undo
3153 3153
     public function getCollectionPersister(array $association)
3154 3154
     {
3155 3155
         $role = isset($association['cache'])
3156
-            ? $association['sourceEntity'] . '::' . $association['fieldName']
3156
+            ? $association['sourceEntity'].'::'.$association['fieldName']
3157 3157
             : $association['type'];
3158 3158
 
3159 3159
         if (isset($this->collectionPersisters[$role])) {
@@ -3371,7 +3371,7 @@  discard block
 block discarded – undo
3371 3371
      */
3372 3372
     private function afterTransactionComplete()
3373 3373
     {
3374
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3374
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3375 3375
             $persister->afterTransactionComplete();
3376 3376
         });
3377 3377
     }
@@ -3381,7 +3381,7 @@  discard block
 block discarded – undo
3381 3381
      */
3382 3382
     private function afterTransactionRolledBack()
3383 3383
     {
3384
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3384
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3385 3385
             $persister->afterTransactionRolledBack();
3386 3386
         });
3387 3387
     }
@@ -3477,11 +3477,11 @@  discard block
 block discarded – undo
3477 3477
      */
3478 3478
     private function mergeEntityStateIntoManagedCopy($entity, $managedCopy)
3479 3479
     {
3480
-        if (! $this->isLoaded($entity)) {
3480
+        if ( ! $this->isLoaded($entity)) {
3481 3481
             return;
3482 3482
         }
3483 3483
 
3484
-        if (! $this->isLoaded($managedCopy)) {
3484
+        if ( ! $this->isLoaded($managedCopy)) {
3485 3485
             $managedCopy->__load();
3486 3486
         }
3487 3487
 
@@ -3504,7 +3504,7 @@  discard block
 block discarded – undo
3504 3504
                     if ($other === null) {
3505 3505
                         $prop->setValue($managedCopy, null);
3506 3506
                     } else {
3507
-                        if ($other instanceof Proxy && !$other->__isInitialized()) {
3507
+                        if ($other instanceof Proxy && ! $other->__isInitialized()) {
3508 3508
                             // do not merge fields marked lazy that have not been fetched.
3509 3509
                             continue;
3510 3510
                         }
@@ -3591,7 +3591,7 @@  discard block
 block discarded – undo
3591 3591
      */
3592 3592
     private function clearIdentityMapForEntityName($entityName)
3593 3593
     {
3594
-        if (! isset($this->identityMap[$entityName])) {
3594
+        if ( ! isset($this->identityMap[$entityName])) {
3595 3595
             return;
3596 3596
         }
3597 3597
 
Please login to merge, or discard this patch.