Completed
Pull Request — master (#5586)
by Mihai
11:08
created
lib/Doctrine/ORM/UnitOfWork.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
         $state = $this->getEntityState($entity);
463 463
 
464 464
         if ($state !== self::STATE_MANAGED && $state !== self::STATE_REMOVED) {
465
-            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation " . self::objToStr($entity));
465
+            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation ".self::objToStr($entity));
466 466
         }
467 467
 
468 468
         $class = $this->em->getClassMetadata(get_class($entity));
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
                     if ($owner === null) { // cloned
681 681
                         $actualValue->setOwner($entity, $assoc);
682 682
                     } else if ($owner !== $entity) { // no clone, we have to fix
683
-                        if (!$actualValue->isInitialized()) {
683
+                        if ( ! $actualValue->isInitialized()) {
684 684
                             $actualValue->initialize(); // we have to do this otherwise the cols share state
685 685
                         }
686 686
                         $newValue = clone $actualValue;
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
         $targetClass    = $this->em->getClassMetadata($assoc['targetEntity']);
827 827
 
828 828
         foreach ($unwrappedValue as $key => $entry) {
829
-            if (! ($entry instanceof $targetClass->name)) {
829
+            if ( ! ($entry instanceof $targetClass->name)) {
830 830
                 throw ORMInvalidArgumentException::invalidAssociation($targetClass, $assoc, $entry);
831 831
             }
832 832
 
@@ -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
 
@@ -2680,7 +2680,7 @@  discard block
 block discarded – undo
2680 2680
                             // then we can append this entity for eager loading!
2681 2681
                             if ($hints['fetchMode'][$class->name][$field] == ClassMetadata::FETCH_EAGER &&
2682 2682
                                 isset($hints[self::HINT_DEFEREAGERLOAD]) &&
2683
-                                !$targetClass->isIdentifierComposite &&
2683
+                                ! $targetClass->isIdentifierComposite &&
2684 2684
                                 $newValue instanceof Proxy &&
2685 2685
                                 $newValue->__isInitialized__ === false) {
2686 2686
 
@@ -2992,7 +2992,7 @@  discard block
 block discarded – undo
2992 2992
      */
2993 2993
     public function size()
2994 2994
     {
2995
-        $countArray = array_map(function ($item) { return count($item); }, $this->identityMap);
2995
+        $countArray = array_map(function($item) { return count($item); }, $this->identityMap);
2996 2996
 
2997 2997
         return array_sum($countArray);
2998 2998
     }
@@ -3058,14 +3058,14 @@  discard block
 block discarded – undo
3058 3058
     public function getCollectionPersister(array $association)
3059 3059
     {
3060 3060
         $role = isset($association['cache'])
3061
-            ? $association['sourceEntity'] . '::' . $association['fieldName']
3061
+            ? $association['sourceEntity'].'::'.$association['fieldName']
3062 3062
             : $association['type'];
3063 3063
 
3064 3064
         if (isset($this->collectionPersisters[$role])) {
3065 3065
             return $this->collectionPersisters[$role];
3066 3066
         }
3067 3067
 
3068
-        if (!isset($association['persister'])) {
3068
+        if ( ! isset($association['persister'])) {
3069 3069
             $association['persister'] = (ClassMetadata::ONE_TO_MANY === $association['type'])
3070 3070
                 ? 'Doctrine\ORM\Persisters\Collection\OneToManyPersister'
3071 3071
                 : 'Doctrine\ORM\Persisters\Collection\ManyToManyPersister';
@@ -3281,7 +3281,7 @@  discard block
 block discarded – undo
3281 3281
      */
3282 3282
     private function afterTransactionComplete()
3283 3283
     {
3284
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3284
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3285 3285
             $persister->afterTransactionComplete();
3286 3286
         });
3287 3287
     }
@@ -3291,7 +3291,7 @@  discard block
 block discarded – undo
3291 3291
      */
3292 3292
     private function afterTransactionRolledBack()
3293 3293
     {
3294
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3294
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3295 3295
             $persister->afterTransactionRolledBack();
3296 3296
         });
3297 3297
     }
@@ -3390,7 +3390,7 @@  discard block
 block discarded – undo
3390 3390
                     if ($other === null) {
3391 3391
                         $prop->setValue($managedCopy, null);
3392 3392
                     } else {
3393
-                        if ($other instanceof Proxy && !$other->__isInitialized()) {
3393
+                        if ($other instanceof Proxy && ! $other->__isInitialized()) {
3394 3394
                             // do not merge fields marked lazy that have not been fetched.
3395 3395
                             continue;
3396 3396
                         }
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                 $metadata->setCustomRepositoryClass((string) $xmlRoot['repository-class']);
63 63
             }
64 64
             if (isset($xmlRoot['persister-class'])) {
65
-                $metadata->setCustomPersisterClass((string)$xmlRoot['persister-class']);
65
+                $metadata->setCustomPersisterClass((string) $xmlRoot['persister-class']);
66 66
             }
67 67
             if (isset($xmlRoot['read-only']) && $this->evaluateBoolean($xmlRoot['read-only'])) {
68 68
                 $metadata->markReadOnly();
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                 isset($xmlRoot['repository-class']) ? (string) $xmlRoot['repository-class'] : null
73 73
             );
74 74
             $metadata->setCustomPersisterClass(
75
-                isset($xmlRoot['persister-class']) ? (string)$xmlRoot['persister-class'] : null
75
+                isset($xmlRoot['persister-class']) ? (string) $xmlRoot['persister-class'] : null
76 76
             );
77 77
             $metadata->isMappedSuperclass = true;
78 78
         } else if ($xmlRoot->getName() == 'embeddable') {
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 
164 164
         if (isset($xmlRoot['inheritance-type'])) {
165 165
             $inheritanceType = (string) $xmlRoot['inheritance-type'];
166
-            $metadata->setInheritanceType(constant('Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_' . $inheritanceType));
166
+            $metadata->setInheritanceType(constant('Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_'.$inheritanceType));
167 167
 
168 168
             if ($metadata->inheritanceType != \Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_NONE) {
169 169
                 // Evaluate <discriminator-column...>
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
                 }
361 361
 
362 362
                 if (isset($oneToOneElement['fetch'])) {
363
-                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string) $oneToOneElement['fetch']);
363
+                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_'.(string) $oneToOneElement['fetch']);
364 364
                 }
365 365
 
366 366
                 if (isset($oneToOneElement['mapped-by'])) {
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
                 );
410 410
 
411 411
                 if (isset($oneToManyElement['fetch'])) {
412
-                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string) $oneToManyElement['fetch']);
412
+                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_'.(string) $oneToManyElement['fetch']);
413 413
                 }
414 414
 
415 415
                 if (isset($oneToManyElement['persister'])) {
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
                 }
461 461
 
462 462
                 if (isset($manyToOneElement['fetch'])) {
463
-                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string) $manyToOneElement['fetch']);
463
+                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_'.(string) $manyToOneElement['fetch']);
464 464
                 }
465 465
 
466 466
                 if (isset($manyToOneElement['inversed-by'])) {
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
                 );
503 503
 
504 504
                 if (isset($manyToManyElement['fetch'])) {
505
-                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string) $manyToManyElement['fetch']);
505
+                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_'.(string) $manyToManyElement['fetch']);
506 506
                 }
507 507
 
508 508
                 if (isset($manyToManyElement['persister'])) {
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
         // Evaluate <lifecycle-callbacks...>
632 632
         if (isset($xmlRoot->{'lifecycle-callbacks'})) {
633 633
             foreach ($xmlRoot->{'lifecycle-callbacks'}->{'lifecycle-callback'} as $lifecycleCallback) {
634
-                $metadata->addLifecycleCallback((string) $lifecycleCallback['method'], constant('Doctrine\ORM\Events::' . (string) $lifecycleCallback['type']));
634
+                $metadata->addLifecycleCallback((string) $lifecycleCallback['method'], constant('Doctrine\ORM\Events::'.(string) $lifecycleCallback['type']));
635 635
             }
636 636
         }
637 637
 
@@ -789,12 +789,12 @@  discard block
 block discarded – undo
789 789
         $region = isset($cacheMapping['region']) ? (string) $cacheMapping['region'] : null;
790 790
         $usage  = isset($cacheMapping['usage']) ? strtoupper($cacheMapping['usage']) : null;
791 791
 
792
-        if ($usage && ! defined('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $usage)) {
792
+        if ($usage && ! defined('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_'.$usage)) {
793 793
             throw new \InvalidArgumentException(sprintf('Invalid cache usage "%s"', $usage));
794 794
         }
795 795
 
796 796
         if ($usage) {
797
-            $usage = constant('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $usage);
797
+            $usage = constant('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_'.$usage);
798 798
         }
799 799
 
800 800
         return array(
Please login to merge, or discard this patch.