Completed
Pull Request — master (#6074)
by Šimon
09:24
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
 
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 
1159 1159
                 $joinColumns = reset($assoc['joinColumns']);
1160 1160
 
1161
-                $calc->addDependency($targetClass->name, $class->name, (int)empty($joinColumns['nullable']));
1161
+                $calc->addDependency($targetClass->name, $class->name, (int) empty($joinColumns['nullable']));
1162 1162
 
1163 1163
                 // If the target class has mapped subclasses, these share the same dependency.
1164 1164
                 if ( ! $targetClass->subClasses) {
@@ -1685,7 +1685,7 @@  discard block
 block discarded – undo
1685 1685
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "persisted");
1686 1686
 
1687 1687
             default:
1688
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1688
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1689 1689
         }
1690 1690
 
1691 1691
         $this->cascadePersist($entity, $visited);
@@ -1755,7 +1755,7 @@  discard block
 block discarded – undo
1755 1755
             case self::STATE_DETACHED:
1756 1756
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "removed");
1757 1757
             default:
1758
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1758
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1759 1759
         }
1760 1760
 
1761 1761
     }
@@ -1906,7 +1906,7 @@  discard block
 block discarded – undo
1906 1906
      */
1907 1907
     private function isLoaded($entity)
1908 1908
     {
1909
-        return !($entity instanceof Proxy) || $entity->__isInitialized();
1909
+        return ! ($entity instanceof Proxy) || $entity->__isInitialized();
1910 1910
     }
1911 1911
 
1912 1912
     /**
@@ -2064,7 +2064,7 @@  discard block
 block discarded – undo
2064 2064
 
2065 2065
         $associationMappings = array_filter(
2066 2066
             $class->associationMappings,
2067
-            function ($assoc) { return $assoc['isCascadeRefresh']; }
2067
+            function($assoc) { return $assoc['isCascadeRefresh']; }
2068 2068
         );
2069 2069
 
2070 2070
         foreach ($associationMappings as $assoc) {
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
 
2108 2108
         $associationMappings = array_filter(
2109 2109
             $class->associationMappings,
2110
-            function ($assoc) { return $assoc['isCascadeDetach']; }
2110
+            function($assoc) { return $assoc['isCascadeDetach']; }
2111 2111
         );
2112 2112
 
2113 2113
         foreach ($associationMappings as $assoc) {
@@ -2151,7 +2151,7 @@  discard block
 block discarded – undo
2151 2151
 
2152 2152
         $associationMappings = array_filter(
2153 2153
             $class->associationMappings,
2154
-            function ($assoc) { return $assoc['isCascadeMerge']; }
2154
+            function($assoc) { return $assoc['isCascadeMerge']; }
2155 2155
         );
2156 2156
 
2157 2157
         foreach ($associationMappings as $assoc) {
@@ -2190,7 +2190,7 @@  discard block
 block discarded – undo
2190 2190
 
2191 2191
         $associationMappings = array_filter(
2192 2192
             $class->associationMappings,
2193
-            function ($assoc) { return $assoc['isCascadePersist']; }
2193
+            function($assoc) { return $assoc['isCascadePersist']; }
2194 2194
         );
2195 2195
 
2196 2196
         foreach ($associationMappings as $assoc) {
@@ -2219,7 +2219,7 @@  discard block
 block discarded – undo
2219 2219
                     break;
2220 2220
 
2221 2221
                 case ($relatedEntities !== null):
2222
-                    if (! $relatedEntities instanceof $assoc['targetEntity']) {
2222
+                    if ( ! $relatedEntities instanceof $assoc['targetEntity']) {
2223 2223
                         throw ORMInvalidArgumentException::invalidAssociation(
2224 2224
                             $this->em->getClassMetadata($assoc['targetEntity']),
2225 2225
                             $assoc,
@@ -2250,13 +2250,13 @@  discard block
 block discarded – undo
2250 2250
 
2251 2251
         $associationMappings = array_filter(
2252 2252
             $class->associationMappings,
2253
-            function ($assoc) { return $assoc['isCascadeRemove']; }
2253
+            function($assoc) { return $assoc['isCascadeRemove']; }
2254 2254
         );
2255 2255
 
2256 2256
         $entitiesToCascade = array();
2257 2257
 
2258 2258
         foreach ($associationMappings as $assoc) {
2259
-            if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2259
+            if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2260 2260
                 $entity->__load();
2261 2261
             }
2262 2262
 
@@ -2320,7 +2320,7 @@  discard block
 block discarded – undo
2320 2320
                     return;
2321 2321
                 }
2322 2322
 
2323
-                if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2323
+                if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2324 2324
                     $entity->__load();
2325 2325
                 }
2326 2326
 
@@ -2335,7 +2335,7 @@  discard block
 block discarded – undo
2335 2335
             case LockMode::NONE === $lockMode:
2336 2336
             case LockMode::PESSIMISTIC_READ === $lockMode:
2337 2337
             case LockMode::PESSIMISTIC_WRITE === $lockMode:
2338
-                if (!$this->em->getConnection()->isTransactionActive()) {
2338
+                if ( ! $this->em->getConnection()->isTransactionActive()) {
2339 2339
                     throw TransactionRequiredException::transactionRequired();
2340 2340
                 }
2341 2341
 
@@ -2669,7 +2669,7 @@  discard block
 block discarded – undo
2669 2669
                             // then we can append this entity for eager loading!
2670 2670
                             if ($hints['fetchMode'][$class->name][$field] == ClassMetadata::FETCH_EAGER &&
2671 2671
                                 isset($hints[self::HINT_DEFEREAGERLOAD]) &&
2672
-                                !$targetClass->isIdentifierComposite &&
2672
+                                ! $targetClass->isIdentifierComposite &&
2673 2673
                                 $newValue instanceof Proxy &&
2674 2674
                                 $newValue->__isInitialized__ === false) {
2675 2675
 
@@ -3036,7 +3036,7 @@  discard block
 block discarded – undo
3036 3036
     public function getCollectionPersister(array $association)
3037 3037
     {
3038 3038
         $role = isset($association['cache'])
3039
-            ? $association['sourceEntity'] . '::' . $association['fieldName']
3039
+            ? $association['sourceEntity'].'::'.$association['fieldName']
3040 3040
             : $association['type'];
3041 3041
 
3042 3042
         if (isset($this->collectionPersisters[$role])) {
@@ -3254,7 +3254,7 @@  discard block
 block discarded – undo
3254 3254
      */
3255 3255
     private function afterTransactionComplete()
3256 3256
     {
3257
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3257
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3258 3258
             $persister->afterTransactionComplete();
3259 3259
         });
3260 3260
     }
@@ -3264,7 +3264,7 @@  discard block
 block discarded – undo
3264 3264
      */
3265 3265
     private function afterTransactionRolledBack()
3266 3266
     {
3267
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3267
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3268 3268
             $persister->afterTransactionRolledBack();
3269 3269
         });
3270 3270
     }
@@ -3303,7 +3303,7 @@  discard block
 block discarded – undo
3303 3303
 
3304 3304
     private function dispatchAfterFlush()
3305 3305
     {
3306
-        if($this->evm->hasListeners(Events::afterFlush)) {
3306
+        if ($this->evm->hasListeners(Events::afterFlush)) {
3307 3307
             $this->evm->dispatchEvent(Events::afterFlush);
3308 3308
         }
3309 3309
     }
@@ -3370,7 +3370,7 @@  discard block
 block discarded – undo
3370 3370
                     if ($other === null) {
3371 3371
                         $prop->setValue($managedCopy, null);
3372 3372
                     } else {
3373
-                        if ($other instanceof Proxy && !$other->__isInitialized()) {
3373
+                        if ($other instanceof Proxy && ! $other->__isInitialized()) {
3374 3374
                             // do not merge fields marked lazy that have not been fetched.
3375 3375
                             continue;
3376 3376
                         }
@@ -3457,7 +3457,7 @@  discard block
 block discarded – undo
3457 3457
      */
3458 3458
     private function clearIdentityMapForEntityName($entityName)
3459 3459
     {
3460
-        if (! isset($this->identityMap[$entityName])) {
3460
+        if ( ! isset($this->identityMap[$entityName])) {
3461 3461
             return;
3462 3462
         }
3463 3463
 
Please login to merge, or discard this patch.