Passed
Pull Request — 2.7 (#7950)
by Mathieu
07:48
created
lib/Doctrine/ORM/UnitOfWork.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
         try {
383 383
             // Collection deletions (deletions of complete collections)
384 384
             foreach ($this->collectionDeletions as $collectionToDelete) {
385
-                if (! $collectionToDelete instanceof PersistentCollection) {
385
+                if ( ! $collectionToDelete instanceof PersistentCollection) {
386 386
                     $this->getCollectionPersister($collectionToDelete->getMapping())->delete($collectionToDelete);
387 387
 
388 388
                     continue;
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
         $state = $this->getEntityState($entity);
515 515
 
516 516
         if ($state !== self::STATE_MANAGED && $state !== self::STATE_REMOVED) {
517
-            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation " . self::objToStr($entity));
517
+            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation ".self::objToStr($entity));
518 518
         }
519 519
 
520 520
         $class = $this->em->getClassMetadata(get_class($entity));
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
         $oid  = spl_object_hash($entity);
571 571
         $data = [];
572 572
 
573
-        if (!isset($this->entityChangeSets[$oid])) {
573
+        if ( ! isset($this->entityChangeSets[$oid])) {
574 574
             return $data;
575 575
         }
576 576
 
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
                     if ($owner === null) { // cloned
734 734
                         $actualValue->setOwner($entity, $assoc);
735 735
                     } else if ($owner !== $entity) { // no clone, we have to fix
736
-                        if (!$actualValue->isInitialized()) {
736
+                        if ( ! $actualValue->isInitialized()) {
737 737
                             $actualValue->initialize(); // we have to do this otherwise the cols share state
738 738
                         }
739 739
                         $newValue = clone $actualValue;
@@ -879,7 +879,7 @@  discard block
 block discarded – undo
879 879
         $targetClass    = $this->em->getClassMetadata($assoc['targetEntity']);
880 880
 
881 881
         foreach ($unwrappedValue as $key => $entry) {
882
-            if (! ($entry instanceof $targetClass->name)) {
882
+            if ( ! ($entry instanceof $targetClass->name)) {
883 883
                 throw ORMInvalidArgumentException::invalidAssociation($targetClass, $assoc, $entry);
884 884
             }
885 885
 
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
 
958 958
             // Some identifiers may be foreign keys to new entities.
959 959
             // In this case, we don't have the value yet and should treat it as if we have a post-insert generator
960
-            if (! $this->hasMissingIdsWhichAreForeignKeys($class, $idValue)) {
960
+            if ( ! $this->hasMissingIdsWhichAreForeignKeys($class, $idValue)) {
961 961
                 $this->entityIdentifiers[$oid] = $idValue;
962 962
             }
963 963
         }
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
             }
1107 1107
         } else {
1108 1108
             foreach ($insertionsForClass as $oid => $entity) {
1109
-                if (! isset($this->entityIdentifiers[$oid])) {
1109
+                if ( ! isset($this->entityIdentifiers[$oid])) {
1110 1110
                     //entity was not added to identity map because some identifiers are foreign keys to new entities.
1111 1111
                     //add it now
1112 1112
                     $this->addToEntityIdentifiersAndEntityMap($class, $oid, $entity);
@@ -1271,7 +1271,7 @@  discard block
 block discarded – undo
1271 1271
 
1272 1272
                 $joinColumns = reset($assoc['joinColumns']);
1273 1273
 
1274
-                $calc->addDependency($targetClass->name, $class->name, (int)empty($joinColumns['nullable']));
1274
+                $calc->addDependency($targetClass->name, $class->name, (int) empty($joinColumns['nullable']));
1275 1275
 
1276 1276
                 // If the target class has mapped subclasses, these share the same dependency.
1277 1277
                 if ( ! $targetClass->subClasses) {
@@ -1794,7 +1794,7 @@  discard block
 block discarded – undo
1794 1794
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "persisted");
1795 1795
 
1796 1796
             default:
1797
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1797
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1798 1798
         }
1799 1799
 
1800 1800
         $this->cascadePersist($entity, $visited);
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
             case self::STATE_DETACHED:
1865 1865
                 throw ORMInvalidArgumentException::detachedEntityCannot($entity, "removed");
1866 1866
             default:
1867
-                throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
1867
+                throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
1868 1868
         }
1869 1869
 
1870 1870
     }
@@ -2003,7 +2003,7 @@  discard block
 block discarded – undo
2003 2003
      */
2004 2004
     private function ensureVersionMatch(ClassMetadata $class, $entity, $managedCopy)
2005 2005
     {
2006
-        if (! ($class->isVersioned && $this->isLoaded($managedCopy) && $this->isLoaded($entity))) {
2006
+        if ( ! ($class->isVersioned && $this->isLoaded($managedCopy) && $this->isLoaded($entity))) {
2007 2007
             return;
2008 2008
         }
2009 2009
 
@@ -2028,7 +2028,7 @@  discard block
 block discarded – undo
2028 2028
      */
2029 2029
     private function isLoaded($entity)
2030 2030
     {
2031
-        return !($entity instanceof Proxy) || $entity->__isInitialized();
2031
+        return ! ($entity instanceof Proxy) || $entity->__isInitialized();
2032 2032
     }
2033 2033
 
2034 2034
     /**
@@ -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['isCascadeRefresh']; }
2191
+            function($assoc) { return $assoc['isCascadeRefresh']; }
2192 2192
         );
2193 2193
 
2194 2194
         foreach ($associationMappings as $assoc) {
@@ -2231,7 +2231,7 @@  discard block
 block discarded – undo
2231 2231
 
2232 2232
         $associationMappings = array_filter(
2233 2233
             $class->associationMappings,
2234
-            function ($assoc) { return $assoc['isCascadeDetach']; }
2234
+            function($assoc) { return $assoc['isCascadeDetach']; }
2235 2235
         );
2236 2236
 
2237 2237
         foreach ($associationMappings as $assoc) {
@@ -2275,7 +2275,7 @@  discard block
 block discarded – undo
2275 2275
 
2276 2276
         $associationMappings = array_filter(
2277 2277
             $class->associationMappings,
2278
-            function ($assoc) { return $assoc['isCascadeMerge']; }
2278
+            function($assoc) { return $assoc['isCascadeMerge']; }
2279 2279
         );
2280 2280
 
2281 2281
         foreach ($associationMappings as $assoc) {
@@ -2314,14 +2314,14 @@  discard block
 block discarded – undo
2314 2314
 
2315 2315
         $associationMappings = array_filter(
2316 2316
             $class->getAssociationMappings(),
2317
-            function ($assoc) { return $assoc['isCascadePersist']; }
2317
+            function($assoc) { return $assoc['isCascadePersist']; }
2318 2318
         );
2319 2319
 
2320 2320
         foreach ($associationMappings as $assoc) {
2321 2321
             $relatedField    = $class->getReflectionProperty($assoc['fieldName']);
2322 2322
             $relatedEntities = null;
2323 2323
 
2324
-            if (! method_exists($relatedField, 'isInitialized') || $relatedField->isInitialized($entity)) {
2324
+            if ( ! method_exists($relatedField, 'isInitialized') || $relatedField->isInitialized($entity)) {
2325 2325
                 $relatedEntities = $relatedField->getValue($entity);
2326 2326
             }
2327 2327
 
@@ -2348,7 +2348,7 @@  discard block
 block discarded – undo
2348 2348
                     break;
2349 2349
 
2350 2350
                 case ($relatedEntities !== null):
2351
-                    if (! $relatedEntities instanceof $assoc['targetEntity']) {
2351
+                    if ( ! $relatedEntities instanceof $assoc['targetEntity']) {
2352 2352
                         throw ORMInvalidArgumentException::invalidAssociation(
2353 2353
                             $this->em->getClassMetadata($assoc['targetEntity']),
2354 2354
                             $assoc,
@@ -2379,13 +2379,13 @@  discard block
 block discarded – undo
2379 2379
 
2380 2380
         $associationMappings = array_filter(
2381 2381
             $class->associationMappings,
2382
-            function ($assoc) { return $assoc['isCascadeRemove']; }
2382
+            function($assoc) { return $assoc['isCascadeRemove']; }
2383 2383
         );
2384 2384
 
2385 2385
         $entitiesToCascade = [];
2386 2386
 
2387 2387
         foreach ($associationMappings as $assoc) {
2388
-            if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2388
+            if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2389 2389
                 $entity->__load();
2390 2390
             }
2391 2391
 
@@ -2449,7 +2449,7 @@  discard block
 block discarded – undo
2449 2449
                     return;
2450 2450
                 }
2451 2451
 
2452
-                if ($entity instanceof Proxy && !$entity->__isInitialized__) {
2452
+                if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
2453 2453
                     $entity->__load();
2454 2454
                 }
2455 2455
 
@@ -2464,7 +2464,7 @@  discard block
 block discarded – undo
2464 2464
             case LockMode::NONE === $lockMode:
2465 2465
             case LockMode::PESSIMISTIC_READ === $lockMode:
2466 2466
             case LockMode::PESSIMISTIC_WRITE === $lockMode:
2467
-                if (!$this->em->getConnection()->isTransactionActive()) {
2467
+                if ( ! $this->em->getConnection()->isTransactionActive()) {
2468 2468
                     throw TransactionRequiredException::transactionRequired();
2469 2469
                 }
2470 2470
 
@@ -2789,7 +2789,7 @@  discard block
 block discarded – undo
2789 2789
                             // then we can append this entity for eager loading!
2790 2790
                             if ($hints['fetchMode'][$class->name][$field] == ClassMetadata::FETCH_EAGER &&
2791 2791
                                 isset($hints[self::HINT_DEFEREAGERLOAD]) &&
2792
-                                !$targetClass->isIdentifierComposite &&
2792
+                                ! $targetClass->isIdentifierComposite &&
2793 2793
                                 $newValue instanceof Proxy &&
2794 2794
                                 $newValue->__isInitialized__ === false) {
2795 2795
 
@@ -3154,7 +3154,7 @@  discard block
 block discarded – undo
3154 3154
     public function getCollectionPersister(array $association)
3155 3155
     {
3156 3156
         $role = isset($association['cache'])
3157
-            ? $association['sourceEntity'] . '::' . $association['fieldName']
3157
+            ? $association['sourceEntity'].'::'.$association['fieldName']
3158 3158
             : $association['type'];
3159 3159
 
3160 3160
         if (isset($this->collectionPersisters[$role])) {
@@ -3372,7 +3372,7 @@  discard block
 block discarded – undo
3372 3372
      */
3373 3373
     private function afterTransactionComplete()
3374 3374
     {
3375
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3375
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3376 3376
             $persister->afterTransactionComplete();
3377 3377
         });
3378 3378
     }
@@ -3382,7 +3382,7 @@  discard block
 block discarded – undo
3382 3382
      */
3383 3383
     private function afterTransactionRolledBack()
3384 3384
     {
3385
-        $this->performCallbackOnCachedPersister(function (CachedPersister $persister) {
3385
+        $this->performCallbackOnCachedPersister(function(CachedPersister $persister) {
3386 3386
             $persister->afterTransactionRolledBack();
3387 3387
         });
3388 3388
     }
@@ -3478,11 +3478,11 @@  discard block
 block discarded – undo
3478 3478
      */
3479 3479
     private function mergeEntityStateIntoManagedCopy($entity, $managedCopy)
3480 3480
     {
3481
-        if (! $this->isLoaded($entity)) {
3481
+        if ( ! $this->isLoaded($entity)) {
3482 3482
             return;
3483 3483
         }
3484 3484
 
3485
-        if (! $this->isLoaded($managedCopy)) {
3485
+        if ( ! $this->isLoaded($managedCopy)) {
3486 3486
             $managedCopy->__load();
3487 3487
         }
3488 3488
 
@@ -3505,7 +3505,7 @@  discard block
 block discarded – undo
3505 3505
                     if ($other === null) {
3506 3506
                         $prop->setValue($managedCopy, null);
3507 3507
                     } else {
3508
-                        if ($other instanceof Proxy && !$other->__isInitialized()) {
3508
+                        if ($other instanceof Proxy && ! $other->__isInitialized()) {
3509 3509
                             // do not merge fields marked lazy that have not been fetched.
3510 3510
                             continue;
3511 3511
                         }
@@ -3592,7 +3592,7 @@  discard block
 block discarded – undo
3592 3592
      */
3593 3593
     private function clearIdentityMapForEntityName($entityName)
3594 3594
     {
3595
-        if (! isset($this->identityMap[$entityName])) {
3595
+        if ( ! isset($this->identityMap[$entityName])) {
3596 3596
             return;
3597 3597
         }
3598 3598
 
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
         $reflField = $class->getReflectionProperty($fieldName);
191 191
         $value     = null;
192 192
 
193
-        if (! method_exists($reflField, 'isInitialized') || $reflField->isInitialized($entity)) {
193
+        if ( ! method_exists($reflField, 'isInitialized') || $reflField->isInitialized($entity)) {
194 194
             $value = $reflField->getValue($entity);
195 195
         }
196 196
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
             $reflField->setValue($entity, $value);
208 208
             $this->_uow->setOriginalEntityProperty($oid, $fieldName, $value);
209 209
 
210
-            $this->initializedCollections[$oid . $fieldName] = $value;
210
+            $this->initializedCollections[$oid.$fieldName] = $value;
211 211
         } else if (
212 212
             isset($this->_hints[Query::HINT_REFRESH]) ||
213 213
             isset($this->_hints['fetched'][$parentDqlAlias][$fieldName]) &&
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
             $value->setInitialized(true);
219 219
             $value->unwrap()->clear();
220 220
 
221
-            $this->initializedCollections[$oid . $fieldName] = $value;
221
+            $this->initializedCollections[$oid.$fieldName] = $value;
222 222
         } else {
223 223
             // Is already PersistentCollection, and DON'T REFRESH or FETCH-JOIN!
224
-            $this->existingCollections[$oid . $fieldName] = $value;
224
+            $this->existingCollections[$oid.$fieldName] = $value;
225 225
         }
226 226
 
227 227
         return $value;
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
             $idHash = '';
296 296
 
297 297
             foreach ($class->identifier as $fieldName) {
298
-                $idHash .= ' ' . (isset($class->associationMappings[$fieldName])
298
+                $idHash .= ' '.(isset($class->associationMappings[$fieldName])
299 299
                     ? $data[$class->associationMappings[$fieldName]['joinColumns'][0]['name']]
300 300
                     : $data[$fieldName]);
301 301
             }
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
                 $parentAlias = $this->_rsm->parentAliasMap[$dqlAlias];
352 352
                 // we need the $path to save into the identifier map which entities were already
353 353
                 // seen for this parent-child relationship
354
-                $path = $parentAlias . '.' . $dqlAlias;
354
+                $path = $parentAlias.'.'.$dqlAlias;
355 355
 
356 356
                 // We have a RIGHT JOIN result here. Doctrine cannot hydrate RIGHT JOIN Object-Graphs
357 357
                 if ( ! isset($nonemptyComponents[$parentAlias])) {
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
                     continue;
360 360
                 }
361 361
 
362
-                $parentClass    = $this->_metadataCache[$this->_rsm->aliasMap[$parentAlias]];
362
+                $parentClass = $this->_metadataCache[$this->_rsm->aliasMap[$parentAlias]];
363 363
                 assert($parentClass instanceof ClassMetadata);
364 364
                 $relationField = $this->_rsm->relationMap[$dqlAlias];
365 365
                 $relation      = $parentClass->getAssociationMapping($relationField);
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
                 $oid            = spl_object_hash($parentObject);
388 388
                 $reflFieldValue = null;
389 389
 
390
-                if (! method_exists($reflField, 'isInitialized') || $reflField->isInitialized($parentObject)) {
390
+                if ( ! method_exists($reflField, 'isInitialized') || $reflField->isInitialized($parentObject)) {
391 391
                     $reflFieldValue = $reflField->getValue($parentObject);
392 392
                 }
393 393
 
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
                 if ( ! ($relation['type'] & ClassMetadata::TO_ONE)) {
396 396
                     // PATH A: Collection-valued association
397 397
                     if (isset($nonemptyComponents[$dqlAlias])) {
398
-                        $collKey = $oid . $relationField;
398
+                        $collKey = $oid.$relationField;
399 399
                         if (isset($this->initializedCollections[$collKey])) {
400 400
                             $reflFieldValue = $this->initializedCollections[$collKey];
401 401
                         } else if ( ! isset($this->existingCollections[$collKey])) {
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 
442 442
                 } else {
443 443
                     // PATH B: Single-valued association
444
-                    if ( ! $reflFieldValue || isset($this->_hints[Query::HINT_REFRESH]) || ($reflFieldValue instanceof Proxy && !$reflFieldValue->__isInitialized__)) {
444
+                    if ( ! $reflFieldValue || isset($this->_hints[Query::HINT_REFRESH]) || ($reflFieldValue instanceof Proxy && ! $reflFieldValue->__isInitialized__)) {
445 445
                         // we only need to take action if this value is null,
446 446
                         // we refresh the entity or its an uninitialized proxy.
447 447
                         if (isset($nonemptyComponents[$dqlAlias])) {
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
                 $entityKey = $this->_rsm->entityMappings[$dqlAlias] ?: 0;
488 488
 
489 489
                 // if this row has a NULL value for the root result id then make it a null result.
490
-                if ( ! isset($nonemptyComponents[$dqlAlias]) ) {
490
+                if ( ! isset($nonemptyComponents[$dqlAlias])) {
491 491
                     if ($this->_rsm->isMixed) {
492 492
                         $result[] = [$entityKey => null];
493 493
                     } else {
@@ -543,13 +543,13 @@  discard block
 block discarded – undo
543 543
             }
544 544
         }
545 545
 
546
-        if ( ! isset($resultKey) ) {
546
+        if ( ! isset($resultKey)) {
547 547
             $this->resultCounter++;
548 548
         }
549 549
 
550 550
         // Append scalar values to mixed result sets
551 551
         if (isset($rowData['scalars'])) {
552
-            if ( ! isset($resultKey) ) {
552
+            if ( ! isset($resultKey)) {
553 553
                 $resultKey = (isset($this->_rsm->indexByMap['scalars']))
554 554
                     ? $row[$this->_rsm->indexByMap['scalars']]
555 555
                     : $this->resultCounter - 1;
@@ -562,19 +562,19 @@  discard block
 block discarded – undo
562 562
 
563 563
         // Append new object to mixed result sets
564 564
         if (isset($rowData['newObjects'])) {
565
-            if ( ! isset($resultKey) ) {
565
+            if ( ! isset($resultKey)) {
566 566
                 $resultKey = $this->resultCounter - 1;
567 567
             }
568 568
 
569 569
 
570
-            $scalarCount = (isset($rowData['scalars'])? count($rowData['scalars']): 0);
570
+            $scalarCount = (isset($rowData['scalars']) ? count($rowData['scalars']) : 0);
571 571
 
572 572
             foreach ($rowData['newObjects'] as $objIndex => $newObject) {
573 573
                 $class  = $newObject['class'];
574 574
                 $args   = $newObject['args'];
575 575
                 $obj    = $class->newInstanceArgs($args);
576 576
 
577
-                if ($scalarCount == 0 && count($rowData['newObjects']) == 1 ) {
577
+                if ($scalarCount == 0 && count($rowData['newObjects']) == 1) {
578 578
                     $result[$resultKey] = $obj;
579 579
 
580 580
                     continue;
Please login to merge, or discard this patch.