Passed
Pull Request — 2.6 (#7861)
by Gabriel
08:02
created
lib/Doctrine/ORM/PersistentCollection.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
      */
401 401
     public function containsKey($key)
402 402
     {
403
-        if (! $this->initialized && $this->association['fetch'] === ClassMetadata::FETCH_EXTRA_LAZY
403
+        if ( ! $this->initialized && $this->association['fetch'] === ClassMetadata::FETCH_EXTRA_LAZY
404 404
             && isset($this->association['indexBy'])) {
405 405
             $persister = $this->em->getUnitOfWork()->getCollectionPersister($this->association);
406 406
 
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
             && $this->association['fetch'] === ClassMetadata::FETCH_EXTRA_LAZY
434 434
             && isset($this->association['indexBy'])
435 435
         ) {
436
-            if (!$this->typeClass->isIdentifierComposite && $this->typeClass->isIdentifier($this->association['indexBy'])) {
436
+            if ( ! $this->typeClass->isIdentifierComposite && $this->typeClass->isIdentifier($this->association['indexBy'])) {
437 437
                 return $this->em->find($this->typeClass->name, $key);
438 438
             }
439 439
 
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
      */
449 449
     public function count()
450 450
     {
451
-        if (! $this->initialized && $this->association !== null && $this->association['fetch'] === ClassMetadata::FETCH_EXTRA_LAZY) {
451
+        if ( ! $this->initialized && $this->association !== null && $this->association['fetch'] === ClassMetadata::FETCH_EXTRA_LAZY) {
452 452
             $persister = $this->em->getUnitOfWork()->getCollectionPersister($this->association);
453 453
 
454 454
             return $persister->count($this) + ($this->isDirty ? $this->collection->count() : 0);
Please login to merge, or discard this patch.
lib/Doctrine/ORM/UnitOfWork.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
         try {
381 381
             // Collection deletions (deletions of complete collections)
382 382
             foreach ($this->collectionDeletions as $collectionToDelete) {
383
-                if (!$collectionToDelete instanceof PersistentCollection ||
383
+                if ( ! $collectionToDelete instanceof PersistentCollection ||
384 384
                     // deferred explicit tracked collections can be removed only when owning relation was persisted
385 385
                     $this->em->getClassMetadata(get_class($owner = $collectionToDelete->getOwner()))->isChangeTrackingDeferredImplicit() || 
386 386
                     $this->isScheduledForDirtyCheck($owner)) {
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
         $state = $this->getEntityState($entity);
507 507
 
508 508
         if ($state !== self::STATE_MANAGED && $state !== self::STATE_REMOVED) {
509
-            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation " . self::objToStr($entity));
509
+            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation ".self::objToStr($entity));
510 510
         }
511 511
 
512 512
         $class = $this->em->getClassMetadata(get_class($entity));
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
         $oid  = spl_object_hash($entity);
563 563
         $data = [];
564 564
 
565
-        if (!isset($this->entityChangeSets[$oid])) {
565
+        if ( ! isset($this->entityChangeSets[$oid])) {
566 566
             return $data;
567 567
         }
568 568
 
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
                     if ($owner === null) { // cloned
726 726
                         $actualValue->setOwner($entity, $assoc);
727 727
                     } else if ($owner !== $entity) { // no clone, we have to fix
728
-                        if (!$actualValue->isInitialized()) {
728
+                        if ( ! $actualValue->isInitialized()) {
729 729
                             $actualValue->initialize(); // we have to do this otherwise the cols share state
730 730
                         }
731 731
                         $newValue = clone $actualValue;
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
         $targetClass    = $this->em->getClassMetadata($assoc['targetEntity']);
872 872
 
873 873
         foreach ($unwrappedValue as $key => $entry) {
874
-            if (! ($entry instanceof $targetClass->name)) {
874
+            if ( ! ($entry instanceof $targetClass->name)) {
875 875
                 throw ORMInvalidArgumentException::invalidAssociation($targetClass, $assoc, $entry);
876 876
             }
877 877
 
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
 
950 950
             // Some identifiers may be foreign keys to new entities.
951 951
             // In this case, we don't have the value yet and should treat it as if we have a post-insert generator
952
-            if (! $this->hasMissingIdsWhichAreForeignKeys($class, $idValue)) {
952
+            if ( ! $this->hasMissingIdsWhichAreForeignKeys($class, $idValue)) {
953 953
                 $this->entityIdentifiers[$oid] = $idValue;
954 954
             }
955 955
         }
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
             }
1099 1099
         } else {
1100 1100
             foreach ($insertionsForClass as $oid => $entity) {
1101
-                if (! isset($this->entityIdentifiers[$oid])) {
1101
+                if ( ! isset($this->entityIdentifiers[$oid])) {
1102 1102
                     //entity was not added to identity map because some identifiers are foreign keys to new entities.
1103 1103
                     //add it now
1104 1104
                     $this->addToEntityIdentifiersAndEntityMap($class, $oid, $entity);
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
 
1264 1264
                 $joinColumns = reset($assoc['joinColumns']);
1265 1265
 
1266
-                $calc->addDependency($targetClass->name, $class->name, (int)empty($joinColumns['nullable']));
1266
+                $calc->addDependency($targetClass->name, $class->name, (int) empty($joinColumns['nullable']));
1267 1267
 
1268 1268
                 // If the target class has mapped subclasses, these share the same dependency.
1269 1269
                 if ( ! $targetClass->subClasses) {
@@ -1786,7 +1786,7 @@  discard block
 block discarded – undo
1786 1786
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "persisted");
1787 1787
 
1788 1788
             default:
1789
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1789
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1790 1790
         }
1791 1791
 
1792 1792
         $this->cascadePersist($entity, $visited);
@@ -1856,7 +1856,7 @@  discard block
 block discarded – undo
1856 1856
             case self::STATE_DETACHED:
1857 1857
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "removed");
1858 1858
             default:
1859
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1859
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1860 1860
         }
1861 1861
 
1862 1862
     }
@@ -1995,7 +1995,7 @@  discard block
 block discarded – undo
1995 1995
      */
1996 1996
     private function ensureVersionMatch(ClassMetadata $class, $entity, $managedCopy)
1997 1997
     {
1998
-        if (! ($class->isVersioned && $this->isLoaded($managedCopy) && $this->isLoaded($entity))) {
1998
+        if ( ! ($class->isVersioned && $this->isLoaded($managedCopy) && $this->isLoaded($entity))) {
1999 1999
             return;
2000 2000
         }
2001 2001
 
@@ -2020,7 +2020,7 @@  discard block
 block discarded – undo
2020 2020
      */
2021 2021
     private function isLoaded($entity)
2022 2022
     {
2023
-        return !($entity instanceof Proxy) || $entity->__isInitialized();
2023
+        return ! ($entity instanceof Proxy) || $entity->__isInitialized();
2024 2024
     }
2025 2025
 
2026 2026
     /**
@@ -2178,7 +2178,7 @@  discard block
 block discarded – undo
2178 2178
 
2179 2179
         $associationMappings = array_filter(
2180 2180
             $class->associationMappings,
2181
-            function ($assoc) { return $assoc['isCascadeRefresh']; }
2181
+            function($assoc) { return $assoc['isCascadeRefresh']; }
2182 2182
         );
2183 2183
 
2184 2184
         foreach ($associationMappings as $assoc) {
@@ -2221,7 +2221,7 @@  discard block
 block discarded – undo
2221 2221
 
2222 2222
         $associationMappings = array_filter(
2223 2223
             $class->associationMappings,
2224
-            function ($assoc) { return $assoc['isCascadeDetach']; }
2224
+            function($assoc) { return $assoc['isCascadeDetach']; }
2225 2225
         );
2226 2226
 
2227 2227
         foreach ($associationMappings as $assoc) {
@@ -2265,7 +2265,7 @@  discard block
 block discarded – undo
2265 2265
 
2266 2266
         $associationMappings = array_filter(
2267 2267
             $class->associationMappings,
2268
-            function ($assoc) { return $assoc['isCascadeMerge']; }
2268
+            function($assoc) { return $assoc['isCascadeMerge']; }
2269 2269
         );
2270 2270
 
2271 2271
         foreach ($associationMappings as $assoc) {
@@ -2304,7 +2304,7 @@  discard block
 block discarded – undo
2304 2304
 
2305 2305
         $associationMappings = array_filter(
2306 2306
             $class->associationMappings,
2307
-            function ($assoc) { return $assoc['isCascadePersist']; }
2307
+            function($assoc) { return $assoc['isCascadePersist']; }
2308 2308
         );
2309 2309
 
2310 2310
         foreach ($associationMappings as $assoc) {
@@ -2333,7 +2333,7 @@  discard block
 block discarded – undo
2333 2333
                     break;
2334 2334
 
2335 2335
                 case ($relatedEntities !== null):
2336
-                    if (! $relatedEntities instanceof $assoc['targetEntity']) {
2336
+                    if ( ! $relatedEntities instanceof $assoc['targetEntity']) {
2337 2337
                         throw ORMInvalidArgumentException::invalidAssociation(
2338 2338
                             $this->em->getClassMetadata($assoc['targetEntity']),
2339 2339
                             $assoc,
@@ -2364,13 +2364,13 @@  discard block
 block discarded – undo
2364 2364
 
2365 2365
         $associationMappings = array_filter(
2366 2366
             $class->associationMappings,
2367
-            function ($assoc) { return $assoc['isCascadeRemove']; }
2367
+            function($assoc) { return $assoc['isCascadeRemove']; }
2368 2368
         );
2369 2369
 
2370 2370
         $entitiesToCascade = [];
2371 2371
 
2372 2372
         foreach ($associationMappings as $assoc) {
2373
-            if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2373
+            if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2374 2374
                 $entity->__load();
2375 2375
             }
2376 2376
 
@@ -2434,7 +2434,7 @@  discard block
 block discarded – undo
2434 2434
                     return;
2435 2435
                 }
2436 2436
 
2437
-                if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2437
+                if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2438 2438
                     $entity->__load();
2439 2439
                 }
2440 2440
 
@@ -2449,7 +2449,7 @@  discard block
 block discarded – undo
2449 2449
             case LockMode::NONE === $lockMode:
2450 2450
             case LockMode::PESSIMISTIC_READ === $lockMode:
2451 2451
             case LockMode::PESSIMISTIC_WRITE === $lockMode:
2452
-                if (!$this->em->getConnection()->isTransactionActive()) {
2452
+                if ( ! $this->em->getConnection()->isTransactionActive()) {
2453 2453
                     throw TransactionRequiredException::transactionRequired();
2454 2454
                 }
2455 2455
 
@@ -2774,7 +2774,7 @@  discard block
 block discarded – undo
2774 2774
                             // then we can append this entity for eager loading!
2775 2775
                             if ($hints['fetchMode'][$class->name][$field] == ClassMetadata::FETCH_EAGER &&
2776 2776
                                 isset($hints[self::HINT_DEFEREAGERLOAD]) &&
2777
-                                !$targetClass->isIdentifierComposite &&
2777
+                                ! $targetClass->isIdentifierComposite &&
2778 2778
                                 $newValue instanceof Proxy &&
2779 2779
                                 $newValue->__isInitialized__ === false) {
2780 2780
 
@@ -3139,7 +3139,7 @@  discard block
 block discarded – undo
3139 3139
     public function getCollectionPersister(array $association)
3140 3140
     {
3141 3141
         $role = isset($association['cache'])
3142
-            ? $association['sourceEntity'] . '::' . $association['fieldName']
3142
+            ? $association['sourceEntity'].'::'.$association['fieldName']
3143 3143
             : $association['type'];
3144 3144
 
3145 3145
         if (isset($this->collectionPersisters[$role])) {
@@ -3357,7 +3357,7 @@  discard block
 block discarded – undo
3357 3357
      */
3358 3358
     private function afterTransactionComplete()
3359 3359
     {
3360
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3360
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3361 3361
             $persister->afterTransactionComplete();
3362 3362
         });
3363 3363
     }
@@ -3367,7 +3367,7 @@  discard block
 block discarded – undo
3367 3367
      */
3368 3368
     private function afterTransactionRolledBack()
3369 3369
     {
3370
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3370
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3371 3371
             $persister->afterTransactionRolledBack();
3372 3372
         });
3373 3373
     }
@@ -3463,11 +3463,11 @@  discard block
 block discarded – undo
3463 3463
      */
3464 3464
     private function mergeEntityStateIntoManagedCopy($entity, $managedCopy)
3465 3465
     {
3466
-        if (! $this->isLoaded($entity)) {
3466
+        if ( ! $this->isLoaded($entity)) {
3467 3467
             return;
3468 3468
         }
3469 3469
 
3470
-        if (! $this->isLoaded($managedCopy)) {
3470
+        if ( ! $this->isLoaded($managedCopy)) {
3471 3471
             $managedCopy->__load();
3472 3472
         }
3473 3473
 
@@ -3490,7 +3490,7 @@  discard block
 block discarded – undo
3490 3490
                     if ($other === null) {
3491 3491
                         $prop->setValue($managedCopy, null);
3492 3492
                     } else {
3493
-                        if ($other instanceof Proxy && !$other->__isInitialized()) {
3493
+                        if ($other instanceof Proxy && ! $other->__isInitialized()) {
3494 3494
                             // do not merge fields marked lazy that have not been fetched.
3495 3495
                             continue;
3496 3496
                         }
@@ -3577,7 +3577,7 @@  discard block
 block discarded – undo
3577 3577
      */
3578 3578
     private function clearIdentityMapForEntityName($entityName)
3579 3579
     {
3580
-        if (! isset($this->identityMap[$entityName])) {
3580
+        if ( ! isset($this->identityMap[$entityName])) {
3581 3581
             return;
3582 3582
         }
3583 3583
 
Please login to merge, or discard this patch.