Completed
Pull Request — master (#5911)
by Reen
10:23
created
lib/Doctrine/ORM/UnitOfWork.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
         $state = $this->getEntityState($entity);
464 464
 
465 465
         if ($state !== self::STATE_MANAGED && $state !== self::STATE_REMOVED) {
466
-            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation " . self::objToStr($entity));
466
+            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation ".self::objToStr($entity));
467 467
         }
468 468
 
469 469
         $class = $this->em->getClassMetadata(get_class($entity));
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
         $oid  = spl_object_hash($entity);
520 520
         $data = array();
521 521
 
522
-        if (!isset($this->entityChangeSets[$oid])) {
522
+        if ( ! isset($this->entityChangeSets[$oid])) {
523 523
             return $data;
524 524
         }
525 525
 
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
                     if ($owner === null) { // cloned
683 683
                         $actualValue->setOwner($entity, $assoc);
684 684
                     } else if ($owner !== $entity) { // no clone, we have to fix
685
-                        if (!$actualValue->isInitialized()) {
685
+                        if ( ! $actualValue->isInitialized()) {
686 686
                             $actualValue->initialize(); // we have to do this otherwise the cols share state
687 687
                         }
688 688
                         $newValue = clone $actualValue;
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
         $targetClass    = $this->em->getClassMetadata($assoc['targetEntity']);
829 829
 
830 830
         foreach ($unwrappedValue as $key => $entry) {
831
-            if (! ($entry instanceof $targetClass->name)) {
831
+            if ( ! ($entry instanceof $targetClass->name)) {
832 832
                 throw ORMInvalidArgumentException::invalidAssociation($targetClass, $assoc, $entry);
833 833
             }
834 834
 
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
                 }
1156 1156
 
1157 1157
                 $joinColumns = reset($assoc['joinColumns']);
1158
-                $weight  = (int)empty($joinColumns['nullable']);
1158
+                $weight = (int) empty($joinColumns['nullable']);
1159 1159
 
1160 1160
                 $calc->addDependency($targetClass->name, $class->name, $weight);
1161 1161
 
@@ -1683,7 +1683,7 @@  discard block
 block discarded – undo
1683 1683
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "persisted");
1684 1684
 
1685 1685
             default:
1686
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1686
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1687 1687
         }
1688 1688
 
1689 1689
         $this->cascadePersist($entity, $visited);
@@ -1753,7 +1753,7 @@  discard block
 block discarded – undo
1753 1753
             case self::STATE_DETACHED:
1754 1754
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "removed");
1755 1755
             default:
1756
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1756
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1757 1757
         }
1758 1758
 
1759 1759
     }
@@ -1904,7 +1904,7 @@  discard block
 block discarded – undo
1904 1904
      */
1905 1905
     private function isLoaded($entity)
1906 1906
     {
1907
-        return !($entity instanceof Proxy) || $entity->__isInitialized();
1907
+        return ! ($entity instanceof Proxy) || $entity->__isInitialized();
1908 1908
     }
1909 1909
 
1910 1910
     /**
@@ -2062,7 +2062,7 @@  discard block
 block discarded – undo
2062 2062
 
2063 2063
         $associationMappings = array_filter(
2064 2064
             $class->associationMappings,
2065
-            function ($assoc) { return $assoc['isCascadeRefresh']; }
2065
+            function($assoc) { return $assoc['isCascadeRefresh']; }
2066 2066
         );
2067 2067
 
2068 2068
         foreach ($associationMappings as $assoc) {
@@ -2105,7 +2105,7 @@  discard block
 block discarded – undo
2105 2105
 
2106 2106
         $associationMappings = array_filter(
2107 2107
             $class->associationMappings,
2108
-            function ($assoc) { return $assoc['isCascadeDetach']; }
2108
+            function($assoc) { return $assoc['isCascadeDetach']; }
2109 2109
         );
2110 2110
 
2111 2111
         foreach ($associationMappings as $assoc) {
@@ -2149,7 +2149,7 @@  discard block
 block discarded – undo
2149 2149
 
2150 2150
         $associationMappings = array_filter(
2151 2151
             $class->associationMappings,
2152
-            function ($assoc) { return $assoc['isCascadeMerge']; }
2152
+            function($assoc) { return $assoc['isCascadeMerge']; }
2153 2153
         );
2154 2154
 
2155 2155
         foreach ($associationMappings as $assoc) {
@@ -2188,7 +2188,7 @@  discard block
 block discarded – undo
2188 2188
 
2189 2189
         $associationMappings = array_filter(
2190 2190
             $class->associationMappings,
2191
-            function ($assoc) { return $assoc['isCascadePersist']; }
2191
+            function($assoc) { return $assoc['isCascadePersist']; }
2192 2192
         );
2193 2193
 
2194 2194
         foreach ($associationMappings as $assoc) {
@@ -2217,7 +2217,7 @@  discard block
 block discarded – undo
2217 2217
                     break;
2218 2218
 
2219 2219
                 case ($relatedEntities !== null):
2220
-                    if (! $relatedEntities instanceof $assoc['targetEntity']) {
2220
+                    if ( ! $relatedEntities instanceof $assoc['targetEntity']) {
2221 2221
                         throw ORMInvalidArgumentException::invalidAssociation(
2222 2222
                             $this->em->getClassMetadata($assoc['targetEntity']),
2223 2223
                             $assoc,
@@ -2248,13 +2248,13 @@  discard block
 block discarded – undo
2248 2248
 
2249 2249
         $associationMappings = array_filter(
2250 2250
             $class->associationMappings,
2251
-            function ($assoc) { return $assoc['isCascadeRemove']; }
2251
+            function($assoc) { return $assoc['isCascadeRemove']; }
2252 2252
         );
2253 2253
 
2254 2254
         $entitiesToCascade = array();
2255 2255
 
2256 2256
         foreach ($associationMappings as $assoc) {
2257
-            if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2257
+            if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2258 2258
                 $entity->__load();
2259 2259
             }
2260 2260
 
@@ -2318,7 +2318,7 @@  discard block
 block discarded – undo
2318 2318
                     return;
2319 2319
                 }
2320 2320
 
2321
-                if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2321
+                if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2322 2322
                     $entity->__load();
2323 2323
                 }
2324 2324
 
@@ -2333,7 +2333,7 @@  discard block
 block discarded – undo
2333 2333
             case LockMode::NONE === $lockMode:
2334 2334
             case LockMode::PESSIMISTIC_READ === $lockMode:
2335 2335
             case LockMode::PESSIMISTIC_WRITE === $lockMode:
2336
-                if (!$this->em->getConnection()->isTransactionActive()) {
2336
+                if ( ! $this->em->getConnection()->isTransactionActive()) {
2337 2337
                     throw TransactionRequiredException::transactionRequired();
2338 2338
                 }
2339 2339
 
@@ -2667,7 +2667,7 @@  discard block
 block discarded – undo
2667 2667
                             // then we can append this entity for eager loading!
2668 2668
                             if ($hints['fetchMode'][$class->name][$field] == ClassMetadata::FETCH_EAGER &&
2669 2669
                                 isset($hints[self::HINT_DEFEREAGERLOAD]) &&
2670
-                                !$targetClass->isIdentifierComposite &&
2670
+                                ! $targetClass->isIdentifierComposite &&
2671 2671
                                 $newValue instanceof Proxy &&
2672 2672
                                 $newValue->__isInitialized__ === false) {
2673 2673
 
@@ -3034,7 +3034,7 @@  discard block
 block discarded – undo
3034 3034
     public function getCollectionPersister(array $association)
3035 3035
     {
3036 3036
         $role = isset($association['cache'])
3037
-            ? $association['sourceEntity'] . '::' . $association['fieldName']
3037
+            ? $association['sourceEntity'].'::'.$association['fieldName']
3038 3038
             : $association['type'];
3039 3039
 
3040 3040
         if (isset($this->collectionPersisters[$role])) {
@@ -3252,7 +3252,7 @@  discard block
 block discarded – undo
3252 3252
      */
3253 3253
     private function afterTransactionComplete()
3254 3254
     {
3255
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3255
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3256 3256
             $persister->afterTransactionComplete();
3257 3257
         });
3258 3258
     }
@@ -3262,7 +3262,7 @@  discard block
 block discarded – undo
3262 3262
      */
3263 3263
     private function afterTransactionRolledBack()
3264 3264
     {
3265
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3265
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3266 3266
             $persister->afterTransactionRolledBack();
3267 3267
         });
3268 3268
     }
@@ -3361,7 +3361,7 @@  discard block
 block discarded – undo
3361 3361
                     if ($other === null) {
3362 3362
                         $prop->setValue($managedCopy, null);
3363 3363
                     } else {
3364
-                        if ($other instanceof Proxy && !$other->__isInitialized()) {
3364
+                        if ($other instanceof Proxy && ! $other->__isInitialized()) {
3365 3365
                             // do not merge fields marked lazy that have not been fetched.
3366 3366
                             continue;
3367 3367
                         }
@@ -3450,7 +3450,7 @@  discard block
 block discarded – undo
3450 3450
      */
3451 3451
     private function clearIdentityMapForEntityName($entityName)
3452 3452
     {
3453
-        if (! isset($this->identityMap[$entityName])) {
3453
+        if ( ! isset($this->identityMap[$entityName])) {
3454 3454
             return;
3455 3455
         }
3456 3456
 
Please login to merge, or discard this patch.