Completed
Pull Request — master (#5911)
by Reen
17:56
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
 
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
 
1157 1157
                 $joinColumns = reset($assoc['joinColumns']);
1158 1158
 
1159
-                $calc->addDependency($targetClass->name, $class->name, (int)empty($joinColumns['nullable']));
1159
+                $calc->addDependency($targetClass->name, $class->name, (int) empty($joinColumns['nullable']));
1160 1160
 
1161 1161
                 // If the target class has mapped subclasses, these share the same dependency.
1162 1162
                 if ( ! $targetClass->subClasses) {
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "persisted");
1683 1683
 
1684 1684
             default:
1685
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1685
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1686 1686
         }
1687 1687
 
1688 1688
         $this->cascadePersist($entity, $visited);
@@ -1752,7 +1752,7 @@  discard block
 block discarded – undo
1752 1752
             case self::STATE_DETACHED:
1753 1753
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "removed");
1754 1754
             default:
1755
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1755
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1756 1756
         }
1757 1757
 
1758 1758
     }
@@ -1903,7 +1903,7 @@  discard block
 block discarded – undo
1903 1903
      */
1904 1904
     private function isLoaded($entity)
1905 1905
     {
1906
-        return !($entity instanceof Proxy) || $entity->__isInitialized();
1906
+        return ! ($entity instanceof Proxy) || $entity->__isInitialized();
1907 1907
     }
1908 1908
 
1909 1909
     /**
@@ -2061,7 +2061,7 @@  discard block
 block discarded – undo
2061 2061
 
2062 2062
         $associationMappings = array_filter(
2063 2063
             $class->associationMappings,
2064
-            function ($assoc) { return $assoc['isCascadeRefresh']; }
2064
+            function($assoc) { return $assoc['isCascadeRefresh']; }
2065 2065
         );
2066 2066
 
2067 2067
         foreach ($associationMappings as $assoc) {
@@ -2104,7 +2104,7 @@  discard block
 block discarded – undo
2104 2104
 
2105 2105
         $associationMappings = array_filter(
2106 2106
             $class->associationMappings,
2107
-            function ($assoc) { return $assoc['isCascadeDetach']; }
2107
+            function($assoc) { return $assoc['isCascadeDetach']; }
2108 2108
         );
2109 2109
 
2110 2110
         foreach ($associationMappings as $assoc) {
@@ -2148,7 +2148,7 @@  discard block
 block discarded – undo
2148 2148
 
2149 2149
         $associationMappings = array_filter(
2150 2150
             $class->associationMappings,
2151
-            function ($assoc) { return $assoc['isCascadeMerge']; }
2151
+            function($assoc) { return $assoc['isCascadeMerge']; }
2152 2152
         );
2153 2153
 
2154 2154
         foreach ($associationMappings as $assoc) {
@@ -2187,7 +2187,7 @@  discard block
 block discarded – undo
2187 2187
 
2188 2188
         $associationMappings = array_filter(
2189 2189
             $class->associationMappings,
2190
-            function ($assoc) { return $assoc['isCascadePersist']; }
2190
+            function($assoc) { return $assoc['isCascadePersist']; }
2191 2191
         );
2192 2192
 
2193 2193
         foreach ($associationMappings as $assoc) {
@@ -2216,7 +2216,7 @@  discard block
 block discarded – undo
2216 2216
                     break;
2217 2217
 
2218 2218
                 case ($relatedEntities !== null):
2219
-                    if (! $relatedEntities instanceof $assoc['targetEntity']) {
2219
+                    if ( ! $relatedEntities instanceof $assoc['targetEntity']) {
2220 2220
                         throw ORMInvalidArgumentException::invalidAssociation(
2221 2221
                             $this->em->getClassMetadata($assoc['targetEntity']),
2222 2222
                             $assoc,
@@ -2247,13 +2247,13 @@  discard block
 block discarded – undo
2247 2247
 
2248 2248
         $associationMappings = array_filter(
2249 2249
             $class->associationMappings,
2250
-            function ($assoc) { return $assoc['isCascadeRemove']; }
2250
+            function($assoc) { return $assoc['isCascadeRemove']; }
2251 2251
         );
2252 2252
 
2253 2253
         $entitiesToCascade = array();
2254 2254
 
2255 2255
         foreach ($associationMappings as $assoc) {
2256
-            if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2256
+            if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2257 2257
                 $entity->__load();
2258 2258
             }
2259 2259
 
@@ -2317,7 +2317,7 @@  discard block
 block discarded – undo
2317 2317
                     return;
2318 2318
                 }
2319 2319
 
2320
-                if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2320
+                if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2321 2321
                     $entity->__load();
2322 2322
                 }
2323 2323
 
@@ -2332,7 +2332,7 @@  discard block
 block discarded – undo
2332 2332
             case LockMode::NONE === $lockMode:
2333 2333
             case LockMode::PESSIMISTIC_READ === $lockMode:
2334 2334
             case LockMode::PESSIMISTIC_WRITE === $lockMode:
2335
-                if (!$this->em->getConnection()->isTransactionActive()) {
2335
+                if ( ! $this->em->getConnection()->isTransactionActive()) {
2336 2336
                     throw TransactionRequiredException::transactionRequired();
2337 2337
                 }
2338 2338
 
@@ -2666,7 +2666,7 @@  discard block
 block discarded – undo
2666 2666
                             // then we can append this entity for eager loading!
2667 2667
                             if ($hints['fetchMode'][$class->name][$field] == ClassMetadata::FETCH_EAGER &&
2668 2668
                                 isset($hints[self::HINT_DEFEREAGERLOAD]) &&
2669
-                                !$targetClass->isIdentifierComposite &&
2669
+                                ! $targetClass->isIdentifierComposite &&
2670 2670
                                 $newValue instanceof Proxy &&
2671 2671
                                 $newValue->__isInitialized__ === false) {
2672 2672
 
@@ -3033,7 +3033,7 @@  discard block
 block discarded – undo
3033 3033
     public function getCollectionPersister(array $association)
3034 3034
     {
3035 3035
         $role = isset($association['cache'])
3036
-            ? $association['sourceEntity'] . '::' . $association['fieldName']
3036
+            ? $association['sourceEntity'].'::'.$association['fieldName']
3037 3037
             : $association['type'];
3038 3038
 
3039 3039
         if (isset($this->collectionPersisters[$role])) {
@@ -3251,7 +3251,7 @@  discard block
 block discarded – undo
3251 3251
      */
3252 3252
     private function afterTransactionComplete()
3253 3253
     {
3254
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3254
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3255 3255
             $persister->afterTransactionComplete();
3256 3256
         });
3257 3257
     }
@@ -3261,7 +3261,7 @@  discard block
 block discarded – undo
3261 3261
      */
3262 3262
     private function afterTransactionRolledBack()
3263 3263
     {
3264
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3264
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3265 3265
             $persister->afterTransactionRolledBack();
3266 3266
         });
3267 3267
     }
@@ -3360,7 +3360,7 @@  discard block
 block discarded – undo
3360 3360
                     if ($other === null) {
3361 3361
                         $prop->setValue($managedCopy, null);
3362 3362
                     } else {
3363
-                        if ($other instanceof Proxy && !$other->__isInitialized()) {
3363
+                        if ($other instanceof Proxy && ! $other->__isInitialized()) {
3364 3364
                             // do not merge fields marked lazy that have not been fetched.
3365 3365
                             continue;
3366 3366
                         }
@@ -3449,7 +3449,7 @@  discard block
 block discarded – undo
3449 3449
      */
3450 3450
     private function clearIdentityMapForEntityName($entityName)
3451 3451
     {
3452
-        if (! isset($this->identityMap[$entityName])) {
3452
+        if ( ! isset($this->identityMap[$entityName])) {
3453 3453
             return;
3454 3454
         }
3455 3455
 
Please login to merge, or discard this patch.