Failed Conditions
Pull Request — 2.7 (#7950)
by Mathieu
07:30
created
lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         $reflField = $class->getReflectionProperty($fieldName);
190 190
         $value     = null;
191 191
 
192
-        if (! method_exists($reflField, 'isInitialized') || $reflField->isInitialized($entity)) {
192
+        if ( ! method_exists($reflField, 'isInitialized') || $reflField->isInitialized($entity)) {
193 193
             $value = $reflField->getValue($entity);
194 194
         }
195 195
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
             $reflField->setValue($entity, $value);
207 207
             $this->_uow->setOriginalEntityProperty($oid, $fieldName, $value);
208 208
 
209
-            $this->initializedCollections[$oid . $fieldName] = $value;
209
+            $this->initializedCollections[$oid.$fieldName] = $value;
210 210
         } else if (
211 211
             isset($this->_hints[Query::HINT_REFRESH]) ||
212 212
             isset($this->_hints['fetched'][$parentDqlAlias][$fieldName]) &&
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
             $value->setInitialized(true);
218 218
             $value->unwrap()->clear();
219 219
 
220
-            $this->initializedCollections[$oid . $fieldName] = $value;
220
+            $this->initializedCollections[$oid.$fieldName] = $value;
221 221
         } else {
222 222
             // Is already PersistentCollection, and DON'T REFRESH or FETCH-JOIN!
223
-            $this->existingCollections[$oid . $fieldName] = $value;
223
+            $this->existingCollections[$oid.$fieldName] = $value;
224 224
         }
225 225
 
226 226
         return $value;
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
             $idHash = '';
295 295
 
296 296
             foreach ($class->identifier as $fieldName) {
297
-                $idHash .= ' ' . (isset($class->associationMappings[$fieldName])
297
+                $idHash .= ' '.(isset($class->associationMappings[$fieldName])
298 298
                     ? $data[$class->associationMappings[$fieldName]['joinColumns'][0]['name']]
299 299
                     : $data[$fieldName]);
300 300
             }
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
                 $parentAlias = $this->_rsm->parentAliasMap[$dqlAlias];
351 351
                 // we need the $path to save into the identifier map which entities were already
352 352
                 // seen for this parent-child relationship
353
-                $path = $parentAlias . '.' . $dqlAlias;
353
+                $path = $parentAlias.'.'.$dqlAlias;
354 354
 
355 355
                 // We have a RIGHT JOIN result here. Doctrine cannot hydrate RIGHT JOIN Object-Graphs
356 356
                 if ( ! isset($nonemptyComponents[$parentAlias])) {
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
                 $oid            = spl_object_hash($parentObject);
387 387
                 $reflFieldValue = null;
388 388
 
389
-                if (! method_exists($reflField, 'isInitialized') || $reflField->isInitialized($parentObject)) {
389
+                if ( ! method_exists($reflField, 'isInitialized') || $reflField->isInitialized($parentObject)) {
390 390
                     $reflFieldValue = $reflField->getValue($parentObject);
391 391
                 }
392 392
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
                 if ( ! ($relation['type'] & ClassMetadata::TO_ONE)) {
395 395
                     // PATH A: Collection-valued association
396 396
                     if (isset($nonemptyComponents[$dqlAlias])) {
397
-                        $collKey = $oid . $relationField;
397
+                        $collKey = $oid.$relationField;
398 398
                         if (isset($this->initializedCollections[$collKey])) {
399 399
                             $reflFieldValue = $this->initializedCollections[$collKey];
400 400
                         } else if ( ! isset($this->existingCollections[$collKey])) {
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 
441 441
                 } else {
442 442
                     // PATH B: Single-valued association
443
-                    if ( ! $reflFieldValue || isset($this->_hints[Query::HINT_REFRESH]) || ($reflFieldValue instanceof Proxy && !$reflFieldValue->__isInitialized__)) {
443
+                    if ( ! $reflFieldValue || isset($this->_hints[Query::HINT_REFRESH]) || ($reflFieldValue instanceof Proxy && ! $reflFieldValue->__isInitialized__)) {
444 444
                         // we only need to take action if this value is null,
445 445
                         // we refresh the entity or its an uninitialized proxy.
446 446
                         if (isset($nonemptyComponents[$dqlAlias])) {
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
                 $entityKey = $this->_rsm->entityMappings[$dqlAlias] ?: 0;
487 487
 
488 488
                 // if this row has a NULL value for the root result id then make it a null result.
489
-                if ( ! isset($nonemptyComponents[$dqlAlias]) ) {
489
+                if ( ! isset($nonemptyComponents[$dqlAlias])) {
490 490
                     if ($this->_rsm->isMixed) {
491 491
                         $result[] = [$entityKey => null];
492 492
                     } else {
@@ -542,13 +542,13 @@  discard block
 block discarded – undo
542 542
             }
543 543
         }
544 544
 
545
-        if ( ! isset($resultKey) ) {
545
+        if ( ! isset($resultKey)) {
546 546
             $this->resultCounter++;
547 547
         }
548 548
 
549 549
         // Append scalar values to mixed result sets
550 550
         if (isset($rowData['scalars'])) {
551
-            if ( ! isset($resultKey) ) {
551
+            if ( ! isset($resultKey)) {
552 552
                 $resultKey = (isset($this->_rsm->indexByMap['scalars']))
553 553
                     ? $row[$this->_rsm->indexByMap['scalars']]
554 554
                     : $this->resultCounter - 1;
@@ -561,19 +561,19 @@  discard block
 block discarded – undo
561 561
 
562 562
         // Append new object to mixed result sets
563 563
         if (isset($rowData['newObjects'])) {
564
-            if ( ! isset($resultKey) ) {
564
+            if ( ! isset($resultKey)) {
565 565
                 $resultKey = $this->resultCounter - 1;
566 566
             }
567 567
 
568 568
 
569
-            $scalarCount = (isset($rowData['scalars'])? count($rowData['scalars']): 0);
569
+            $scalarCount = (isset($rowData['scalars']) ? count($rowData['scalars']) : 0);
570 570
 
571 571
             foreach ($rowData['newObjects'] as $objIndex => $newObject) {
572 572
                 $class  = $newObject['class'];
573 573
                 $args   = $newObject['args'];
574 574
                 $obj    = $class->newInstanceArgs($args);
575 575
 
576
-                if ($scalarCount == 0 && count($rowData['newObjects']) == 1 ) {
576
+                if ($scalarCount == 0 && count($rowData['newObjects']) == 1) {
577 577
                     $result[$resultKey] = $obj;
578 578
 
579 579
                     continue;
Please login to merge, or discard this patch.
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.