Completed
Pull Request — master (#1139)
by Asmir
11:11
created
lib/Doctrine/ORM/UnitOfWork.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
         $state = $this->getEntityState($entity);
482 482
 
483 483
         if ($state !== self::STATE_MANAGED && $state !== self::STATE_REMOVED) {
484
-            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation " . self::objToStr($entity));
484
+            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation ".self::objToStr($entity));
485 485
         }
486 486
 
487 487
         $class = $this->em->getClassMetadata(get_class($entity));
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
         $oid  = spl_object_hash($entity);
541 541
         $data = array();
542 542
 
543
-        if (!isset($this->entityChangeSets[$oid])) {
543
+        if ( ! isset($this->entityChangeSets[$oid])) {
544 544
             return $data;
545 545
         }
546 546
 
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
                     if ($owner === null) { // cloned
704 704
                         $actualValue->setOwner($entity, $assoc);
705 705
                     } else if ($owner !== $entity) { // no clone, we have to fix
706
-                        if (!$actualValue->isInitialized()) {
706
+                        if ( ! $actualValue->isInitialized()) {
707 707
                             $actualValue->initialize(); // we have to do this otherwise the cols share state
708 708
                         }
709 709
                         $newValue = clone $actualValue;
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
         $targetClass    = $this->em->getClassMetadata($assoc['targetEntity']);
853 853
 
854 854
         foreach ($unwrappedValue as $key => $entry) {
855
-            if (! ($entry instanceof $targetClass->name)) {
855
+            if ( ! ($entry instanceof $targetClass->name)) {
856 856
                 throw ORMInvalidArgumentException::invalidAssociation($targetClass, $assoc, $entry);
857 857
             }
858 858
 
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
 
1181 1181
                 $joinColumns = reset($assoc['joinColumns']);
1182 1182
 
1183
-                $calc->addDependency($targetClass->name, $class->name, (int)empty($joinColumns['nullable']));
1183
+                $calc->addDependency($targetClass->name, $class->name, (int) empty($joinColumns['nullable']));
1184 1184
 
1185 1185
                 // If the target class has mapped subclasses, these share the same dependency.
1186 1186
                 if ( ! $targetClass->subClasses) {
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
         if (isset($this->entityDeletions[$oid])) {
1227 1227
             throw ORMInvalidArgumentException::scheduleInsertForRemovedEntity($entity);
1228 1228
         }
1229
-        if (isset($this->originalEntityData[$oid]) && ! isset($this->entityInsertions[$oid]) && !isset($this->entityShouldBeInserted[$oid])) {
1229
+        if (isset($this->originalEntityData[$oid]) && ! isset($this->entityInsertions[$oid]) && ! isset($this->entityShouldBeInserted[$oid])) {
1230 1230
             throw ORMInvalidArgumentException::scheduleInsertForManagedEntity($entity);
1231 1231
         }
1232 1232
 
@@ -1712,7 +1712,7 @@  discard block
 block discarded – undo
1712 1712
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "persisted");
1713 1713
 
1714 1714
             default:
1715
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1715
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1716 1716
         }
1717 1717
 
1718 1718
         $this->cascadePersist($entity, $visited);
@@ -1782,7 +1782,7 @@  discard block
 block discarded – undo
1782 1782
             case self::STATE_DETACHED:
1783 1783
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "removed");
1784 1784
             default:
1785
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1785
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1786 1786
         }
1787 1787
 
1788 1788
     }
@@ -1933,7 +1933,7 @@  discard block
 block discarded – undo
1933 1933
      */
1934 1934
     private function isLoaded($entity)
1935 1935
     {
1936
-        return !($entity instanceof Proxy) || $entity->__isInitialized();
1936
+        return ! ($entity instanceof Proxy) || $entity->__isInitialized();
1937 1937
     }
1938 1938
 
1939 1939
     /**
@@ -2095,7 +2095,7 @@  discard block
 block discarded – undo
2095 2095
 
2096 2096
         $associationMappings = array_filter(
2097 2097
             $class->associationMappings,
2098
-            function ($assoc) { return $assoc['isCascadeRefresh']; }
2098
+            function($assoc) { return $assoc['isCascadeRefresh']; }
2099 2099
         );
2100 2100
 
2101 2101
         foreach ($associationMappings as $assoc) {
@@ -2138,7 +2138,7 @@  discard block
 block discarded – undo
2138 2138
 
2139 2139
         $associationMappings = array_filter(
2140 2140
             $class->associationMappings,
2141
-            function ($assoc) { return $assoc['isCascadeDetach']; }
2141
+            function($assoc) { return $assoc['isCascadeDetach']; }
2142 2142
         );
2143 2143
 
2144 2144
         foreach ($associationMappings as $assoc) {
@@ -2182,7 +2182,7 @@  discard block
 block discarded – undo
2182 2182
 
2183 2183
         $associationMappings = array_filter(
2184 2184
             $class->associationMappings,
2185
-            function ($assoc) { return $assoc['isCascadeMerge']; }
2185
+            function($assoc) { return $assoc['isCascadeMerge']; }
2186 2186
         );
2187 2187
 
2188 2188
         foreach ($associationMappings as $assoc) {
@@ -2221,7 +2221,7 @@  discard block
 block discarded – undo
2221 2221
 
2222 2222
         $associationMappings = array_filter(
2223 2223
             $class->associationMappings,
2224
-            function ($assoc) { return $assoc['isCascadePersist']; }
2224
+            function($assoc) { return $assoc['isCascadePersist']; }
2225 2225
         );
2226 2226
 
2227 2227
         foreach ($associationMappings as $assoc) {
@@ -2250,7 +2250,7 @@  discard block
 block discarded – undo
2250 2250
                     break;
2251 2251
 
2252 2252
                 case ($relatedEntities !== null):
2253
-                    if (! $relatedEntities instanceof $assoc['targetEntity']) {
2253
+                    if ( ! $relatedEntities instanceof $assoc['targetEntity']) {
2254 2254
                         throw ORMInvalidArgumentException::invalidAssociation(
2255 2255
                             $this->em->getClassMetadata($assoc['targetEntity']),
2256 2256
                             $assoc,
@@ -2281,13 +2281,13 @@  discard block
 block discarded – undo
2281 2281
 
2282 2282
         $associationMappings = array_filter(
2283 2283
             $class->associationMappings,
2284
-            function ($assoc) { return $assoc['isCascadeRemove']; }
2284
+            function($assoc) { return $assoc['isCascadeRemove']; }
2285 2285
         );
2286 2286
 
2287 2287
         $entitiesToCascade = array();
2288 2288
 
2289 2289
         foreach ($associationMappings as $assoc) {
2290
-            if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2290
+            if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2291 2291
                 $entity->__load();
2292 2292
             }
2293 2293
 
@@ -2351,7 +2351,7 @@  discard block
 block discarded – undo
2351 2351
                     return;
2352 2352
                 }
2353 2353
 
2354
-                if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2354
+                if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2355 2355
                     $entity->__load();
2356 2356
                 }
2357 2357
 
@@ -2366,7 +2366,7 @@  discard block
 block discarded – undo
2366 2366
             case LockMode::NONE === $lockMode:
2367 2367
             case LockMode::PESSIMISTIC_READ === $lockMode:
2368 2368
             case LockMode::PESSIMISTIC_WRITE === $lockMode:
2369
-                if (!$this->em->getConnection()->isTransactionActive()) {
2369
+                if ( ! $this->em->getConnection()->isTransactionActive()) {
2370 2370
                     throw TransactionRequiredException::transactionRequired();
2371 2371
                 }
2372 2372
 
@@ -2701,7 +2701,7 @@  discard block
 block discarded – undo
2701 2701
                             // then we can append this entity for eager loading!
2702 2702
                             if ($hints['fetchMode'][$class->name][$field] == ClassMetadata::FETCH_EAGER &&
2703 2703
                                 isset($hints[self::HINT_DEFEREAGERLOAD]) &&
2704
-                                !$targetClass->isIdentifierComposite &&
2704
+                                ! $targetClass->isIdentifierComposite &&
2705 2705
                                 $newValue instanceof Proxy &&
2706 2706
                                 $newValue->__isInitialized__ === false) {
2707 2707
 
@@ -2998,7 +2998,7 @@  discard block
 block discarded – undo
2998 2998
      */
2999 2999
     public function hasPendingInsertions()
3000 3000
     {
3001
-        return ! empty($this->entityInsertions) || !empty($this->entityShouldBeInserted);
3001
+        return ! empty($this->entityInsertions) || ! empty($this->entityShouldBeInserted);
3002 3002
     }
3003 3003
 
3004 3004
     /**
@@ -3068,7 +3068,7 @@  discard block
 block discarded – undo
3068 3068
     public function getCollectionPersister(array $association)
3069 3069
     {
3070 3070
         $role = isset($association['cache'])
3071
-            ? $association['sourceEntity'] . '::' . $association['fieldName']
3071
+            ? $association['sourceEntity'].'::'.$association['fieldName']
3072 3072
             : $association['type'];
3073 3073
 
3074 3074
         if (isset($this->collectionPersisters[$role])) {
@@ -3286,7 +3286,7 @@  discard block
 block discarded – undo
3286 3286
      */
3287 3287
     private function afterTransactionComplete()
3288 3288
     {
3289
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3289
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3290 3290
             $persister->afterTransactionComplete();
3291 3291
         });
3292 3292
     }
@@ -3296,7 +3296,7 @@  discard block
 block discarded – undo
3296 3296
      */
3297 3297
     private function afterTransactionRolledBack()
3298 3298
     {
3299
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3299
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3300 3300
             $persister->afterTransactionRolledBack();
3301 3301
         });
3302 3302
     }
@@ -3395,7 +3395,7 @@  discard block
 block discarded – undo
3395 3395
                     if ($other === null) {
3396 3396
                         $prop->setValue($managedCopy, null);
3397 3397
                     } else {
3398
-                        if ($other instanceof Proxy && !$other->__isInitialized()) {
3398
+                        if ($other instanceof Proxy && ! $other->__isInitialized()) {
3399 3399
                             // do not merge fields marked lazy that have not been fetched.
3400 3400
                             continue;
3401 3401
                         }
@@ -3482,7 +3482,7 @@  discard block
 block discarded – undo
3482 3482
      */
3483 3483
     private function clearIdentityMapForEntityName($entityName)
3484 3484
     {
3485
-        if (! isset($this->identityMap[$entityName])) {
3485
+        if ( ! isset($this->identityMap[$entityName])) {
3486 3486
             return;
3487 3487
         }
3488 3488
 
Please login to merge, or discard this patch.