Completed
Pull Request — master (#5866)
by Šimon
14:49
created
lib/Doctrine/ORM/UnitOfWork.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
         $state = $this->getEntityState($entity);
466 466
 
467 467
         if ($state !== self::STATE_MANAGED && $state !== self::STATE_REMOVED) {
468
-            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation " . self::objToStr($entity));
468
+            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation ".self::objToStr($entity));
469 469
         }
470 470
 
471 471
         $class = $this->em->getClassMetadata(get_class($entity));
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
         $oid  = spl_object_hash($entity);
522 522
         $data = array();
523 523
 
524
-        if (!isset($this->entityChangeSets[$oid])) {
524
+        if ( ! isset($this->entityChangeSets[$oid])) {
525 525
             return $data;
526 526
         }
527 527
 
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
                     if ($owner === null) { // cloned
685 685
                         $actualValue->setOwner($entity, $assoc);
686 686
                     } else if ($owner !== $entity) { // no clone, we have to fix
687
-                        if (!$actualValue->isInitialized()) {
687
+                        if ( ! $actualValue->isInitialized()) {
688 688
                             $actualValue->initialize(); // we have to do this otherwise the cols share state
689 689
                         }
690 690
                         $newValue = clone $actualValue;
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
         $targetClass    = $this->em->getClassMetadata($assoc['targetEntity']);
831 831
 
832 832
         foreach ($unwrappedValue as $key => $entry) {
833
-            if (! ($entry instanceof $targetClass->name)) {
833
+            if ( ! ($entry instanceof $targetClass->name)) {
834 834
                 throw ORMInvalidArgumentException::invalidAssociation($targetClass, $assoc, $entry);
835 835
             }
836 836
 
@@ -1689,7 +1689,7 @@  discard block
 block discarded – undo
1689 1689
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "persisted");
1690 1690
 
1691 1691
             default:
1692
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1692
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1693 1693
         }
1694 1694
 
1695 1695
         $this->cascadePersist($entity, $visited);
@@ -1759,7 +1759,7 @@  discard block
 block discarded – undo
1759 1759
             case self::STATE_DETACHED:
1760 1760
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "removed");
1761 1761
             default:
1762
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1762
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1763 1763
         }
1764 1764
 
1765 1765
     }
@@ -1910,7 +1910,7 @@  discard block
 block discarded – undo
1910 1910
      */
1911 1911
     private function isLoaded($entity)
1912 1912
     {
1913
-        return !($entity instanceof Proxy) || $entity->__isInitialized();
1913
+        return ! ($entity instanceof Proxy) || $entity->__isInitialized();
1914 1914
     }
1915 1915
 
1916 1916
     /**
@@ -2068,7 +2068,7 @@  discard block
 block discarded – undo
2068 2068
 
2069 2069
         $associationMappings = array_filter(
2070 2070
             $class->associationMappings,
2071
-            function ($assoc) { return $assoc['isCascadeRefresh']; }
2071
+            function($assoc) { return $assoc['isCascadeRefresh']; }
2072 2072
         );
2073 2073
 
2074 2074
         foreach ($associationMappings as $assoc) {
@@ -2111,7 +2111,7 @@  discard block
 block discarded – undo
2111 2111
 
2112 2112
         $associationMappings = array_filter(
2113 2113
             $class->associationMappings,
2114
-            function ($assoc) { return $assoc['isCascadeDetach']; }
2114
+            function($assoc) { return $assoc['isCascadeDetach']; }
2115 2115
         );
2116 2116
 
2117 2117
         foreach ($associationMappings as $assoc) {
@@ -2155,7 +2155,7 @@  discard block
 block discarded – undo
2155 2155
 
2156 2156
         $associationMappings = array_filter(
2157 2157
             $class->associationMappings,
2158
-            function ($assoc) { return $assoc['isCascadeMerge']; }
2158
+            function($assoc) { return $assoc['isCascadeMerge']; }
2159 2159
         );
2160 2160
 
2161 2161
         foreach ($associationMappings as $assoc) {
@@ -2194,7 +2194,7 @@  discard block
 block discarded – undo
2194 2194
 
2195 2195
         $associationMappings = array_filter(
2196 2196
             $class->associationMappings,
2197
-            function ($assoc) { return $assoc['isCascadePersist']; }
2197
+            function($assoc) { return $assoc['isCascadePersist']; }
2198 2198
         );
2199 2199
 
2200 2200
         foreach ($associationMappings as $assoc) {
@@ -2223,7 +2223,7 @@  discard block
 block discarded – undo
2223 2223
                     break;
2224 2224
 
2225 2225
                 case ($relatedEntities !== null):
2226
-                    if (! $relatedEntities instanceof $assoc['targetEntity']) {
2226
+                    if ( ! $relatedEntities instanceof $assoc['targetEntity']) {
2227 2227
                         throw ORMInvalidArgumentException::invalidAssociation(
2228 2228
                             $this->em->getClassMetadata($assoc['targetEntity']),
2229 2229
                             $assoc,
@@ -2254,13 +2254,13 @@  discard block
 block discarded – undo
2254 2254
 
2255 2255
         $associationMappings = array_filter(
2256 2256
             $class->associationMappings,
2257
-            function ($assoc) { return $assoc['isCascadeRemove']; }
2257
+            function($assoc) { return $assoc['isCascadeRemove']; }
2258 2258
         );
2259 2259
 
2260 2260
         $entitiesToCascade = array();
2261 2261
 
2262 2262
         foreach ($associationMappings as $assoc) {
2263
-            if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2263
+            if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2264 2264
                 $entity->__load();
2265 2265
             }
2266 2266
 
@@ -2324,7 +2324,7 @@  discard block
 block discarded – undo
2324 2324
                     return;
2325 2325
                 }
2326 2326
 
2327
-                if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2327
+                if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2328 2328
                     $entity->__load();
2329 2329
                 }
2330 2330
 
@@ -2339,7 +2339,7 @@  discard block
 block discarded – undo
2339 2339
             case LockMode::NONE === $lockMode:
2340 2340
             case LockMode::PESSIMISTIC_READ === $lockMode:
2341 2341
             case LockMode::PESSIMISTIC_WRITE === $lockMode:
2342
-                if (!$this->em->getConnection()->isTransactionActive()) {
2342
+                if ( ! $this->em->getConnection()->isTransactionActive()) {
2343 2343
                     throw TransactionRequiredException::transactionRequired();
2344 2344
                 }
2345 2345
 
@@ -2675,7 +2675,7 @@  discard block
 block discarded – undo
2675 2675
                             // then we can append this entity for eager loading!
2676 2676
                             if ($hints['fetchMode'][$class->name][$field] == ClassMetadata::FETCH_EAGER &&
2677 2677
                                 isset($hints[self::HINT_DEFEREAGERLOAD]) &&
2678
-                                !$targetClass->isIdentifierComposite &&
2678
+                                ! $targetClass->isIdentifierComposite &&
2679 2679
                                 $newValue instanceof Proxy &&
2680 2680
                                 $newValue->__isInitialized__ === false) {
2681 2681
 
@@ -2987,7 +2987,7 @@  discard block
 block discarded – undo
2987 2987
      */
2988 2988
     public function size()
2989 2989
     {
2990
-        $countArray = array_map(function ($item) { return count($item); }, $this->identityMap);
2990
+        $countArray = array_map(function($item) { return count($item); }, $this->identityMap);
2991 2991
 
2992 2992
         return array_sum($countArray);
2993 2993
     }
@@ -3046,7 +3046,7 @@  discard block
 block discarded – undo
3046 3046
     public function getCollectionPersister(array $association)
3047 3047
     {
3048 3048
         $role = isset($association['cache'])
3049
-            ? $association['sourceEntity'] . '::' . $association['fieldName']
3049
+            ? $association['sourceEntity'].'::'.$association['fieldName']
3050 3050
             : $association['type'];
3051 3051
 
3052 3052
         if (isset($this->collectionPersisters[$role])) {
@@ -3264,7 +3264,7 @@  discard block
 block discarded – undo
3264 3264
      */
3265 3265
     private function afterTransactionComplete()
3266 3266
     {
3267
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3267
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3268 3268
             $persister->afterTransactionComplete();
3269 3269
         });
3270 3270
     }
@@ -3274,7 +3274,7 @@  discard block
 block discarded – undo
3274 3274
      */
3275 3275
     private function afterTransactionRolledBack()
3276 3276
     {
3277
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3277
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3278 3278
             $persister->afterTransactionRolledBack();
3279 3279
         });
3280 3280
     }
@@ -3313,7 +3313,7 @@  discard block
 block discarded – undo
3313 3313
 
3314 3314
     private function dispatchAfterFlush()
3315 3315
     {
3316
-        if($this->evm->hasListeners(Events::afterFlush)) {
3316
+        if ($this->evm->hasListeners(Events::afterFlush)) {
3317 3317
             $this->evm->dispatchEvent(Events::afterFlush);
3318 3318
         }
3319 3319
     }
@@ -3380,7 +3380,7 @@  discard block
 block discarded – undo
3380 3380
                     if ($other === null) {
3381 3381
                         $prop->setValue($managedCopy, null);
3382 3382
                     } else {
3383
-                        if ($other instanceof Proxy && !$other->__isInitialized()) {
3383
+                        if ($other instanceof Proxy && ! $other->__isInitialized()) {
3384 3384
                             // do not merge fields marked lazy that have not been fetched.
3385 3385
                             continue;
3386 3386
                         }
@@ -3469,7 +3469,7 @@  discard block
 block discarded – undo
3469 3469
      */
3470 3470
     private function clearIdentityMapForEntityName($entityName)
3471 3471
     {
3472
-        if (! isset($this->identityMap[$entityName])) {
3472
+        if ( ! isset($this->identityMap[$entityName])) {
3473 3473
             return;
3474 3474
         }
3475 3475
 
Please login to merge, or discard this patch.