@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Doctrine\ORM\Mapping; |
6 | 6 | |
@@ -8,6 +8,6 @@ discard block |
||
8 | 8 | { |
9 | 9 | public static function create(string $generatorType) : self |
10 | 10 | { |
11 | - return new self("Unknown generator type: " . $generatorType); |
|
11 | + return new self("Unknown generator type: ".$generatorType); |
|
12 | 12 | } |
13 | 13 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Doctrine\ORM; |
6 | 6 | |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | // Entity deletions come last and need to be in reverse commit order |
391 | 391 | if ($this->entityDeletions) { |
392 | 392 | foreach (array_reverse($commitOrder) as $committedEntityName) { |
393 | - if (! $this->entityDeletions) { |
|
393 | + if ( ! $this->entityDeletions) { |
|
394 | 394 | break; // just a performance optimisation |
395 | 395 | } |
396 | 396 | |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | $oid = spl_object_hash($entity); |
476 | 476 | $data = []; |
477 | 477 | |
478 | - if (!isset($this->entityChangeSets[$oid])) { |
|
478 | + if ( ! isset($this->entityChangeSets[$oid])) { |
|
479 | 479 | return $data; |
480 | 480 | } |
481 | 481 | |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | || ! $class->getProperty($name) instanceof FieldMetadata |
559 | 559 | || ! $class->getProperty($name)->hasValueGenerator() |
560 | 560 | || $class->getProperty($name)->getValueGenerator()->getType() !== GeneratorType::IDENTITY |
561 | - ) && (! $class->isVersioned() || $name !== $class->versionProperty->getName())) { |
|
561 | + ) && ( ! $class->isVersioned() || $name !== $class->versionProperty->getName())) { |
|
562 | 562 | $actualData[$name] = $value; |
563 | 563 | } |
564 | 564 | } |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | if ($owner === null) { // cloned |
613 | 613 | $actualValue->setOwner($entity, $property); |
614 | 614 | } else if ($owner !== $entity) { // no clone, we have to fix |
615 | - if (! $actualValue->isInitialized()) { |
|
615 | + if ( ! $actualValue->isInitialized()) { |
|
616 | 616 | $actualValue->initialize(); // we have to do this otherwise the cols share state |
617 | 617 | } |
618 | 618 | |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | // Check if original value exists |
651 | 651 | if ($orgValue instanceof PersistentCollection) { |
652 | 652 | // A PersistentCollection was de-referenced, so delete it. |
653 | - if (! $this->isCollectionScheduledForDeletion($orgValue)) { |
|
653 | + if ( ! $this->isCollectionScheduledForDeletion($orgValue)) { |
|
654 | 654 | $this->scheduleCollectionDeletion($orgValue); |
655 | 655 | |
656 | 656 | $changeSet[$propName] = $orgValue; // Signal changeset, to-many associations will be ignored |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | |
674 | 674 | // Look for changes in associations of the entity |
675 | 675 | foreach ($class->getDeclaredPropertiesIterator() as $property) { |
676 | - if (! ($property instanceof AssociationMetadata) || ($value = $property->getValue($entity)) === null) { |
|
676 | + if ( ! ($property instanceof AssociationMetadata) || ($value = $property->getValue($entity)) === null) { |
|
677 | 677 | continue; |
678 | 678 | } |
679 | 679 | |
@@ -777,13 +777,13 @@ discard block |
||
777 | 777 | $targetClass = $this->em->getClassMetadata($targetEntity); |
778 | 778 | |
779 | 779 | foreach ($unwrappedValue as $key => $entry) { |
780 | - if (! ($entry instanceof $targetEntity)) { |
|
780 | + if ( ! ($entry instanceof $targetEntity)) { |
|
781 | 781 | throw ORMInvalidArgumentException::invalidAssociation($targetClass, $association, $entry); |
782 | 782 | } |
783 | 783 | |
784 | 784 | $state = $this->getEntityState($entry, self::STATE_NEW); |
785 | 785 | |
786 | - if (! ($entry instanceof $targetEntity)) { |
|
786 | + if ( ! ($entry instanceof $targetEntity)) { |
|
787 | 787 | throw UnexpectedAssociationValue::create( |
788 | 788 | $association->getSourceEntity(), |
789 | 789 | $association->getName(), |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | $persister = $this->getEntityPersister($class->getClassName()); |
846 | 846 | $generationPlan->executeImmediate($this->em, $entity); |
847 | 847 | |
848 | - if (! $generationPlan->containsDeferred()) { |
|
848 | + if ( ! $generationPlan->containsDeferred()) { |
|
849 | 849 | $id = $this->em->getIdentifierFlattener()->flattenIdentifier($class, $persister->getIdentifier($entity)); |
850 | 850 | $this->entityIdentifiers[$oid] = $id; |
851 | 851 | } |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | { |
879 | 879 | $oid = spl_object_hash($entity); |
880 | 880 | |
881 | - if (! isset($this->entityStates[$oid]) || $this->entityStates[$oid] !== self::STATE_MANAGED) { |
|
881 | + if ( ! isset($this->entityStates[$oid]) || $this->entityStates[$oid] !== self::STATE_MANAGED) { |
|
882 | 882 | throw ORMInvalidArgumentException::entityNotManaged($entity); |
883 | 883 | } |
884 | 884 | |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | break; |
901 | 901 | |
902 | 902 | case ($property instanceof FieldMetadata): |
903 | - if (! $property->isPrimaryKey() |
|
903 | + if ( ! $property->isPrimaryKey() |
|
904 | 904 | || ! $property->getValueGenerator() |
905 | 905 | || $property->getValueGenerator()->getType() !== GeneratorType::IDENTITY) { |
906 | 906 | $actualData[$name] = $property->getValue($entity); |
@@ -1053,7 +1053,7 @@ discard block |
||
1053 | 1053 | // Entity with this $oid after deletion treated as NEW, even if the $oid |
1054 | 1054 | // is obtained by a new entity because the old one went out of scope. |
1055 | 1055 | //$this->entityStates[$oid] = self::STATE_NEW; |
1056 | - if (! $class->isIdentifierComposite()) { |
|
1056 | + if ( ! $class->isIdentifierComposite()) { |
|
1057 | 1057 | $property = $class->getProperty($class->getSingleIdentifierFieldName()); |
1058 | 1058 | |
1059 | 1059 | if ($property instanceof FieldMetadata && $property->hasValueGenerator()) { |
@@ -1100,7 +1100,7 @@ discard block |
||
1100 | 1100 | // Calculate dependencies for new nodes |
1101 | 1101 | while ($class = array_pop($newNodes)) { |
1102 | 1102 | foreach ($class->getDeclaredPropertiesIterator() as $property) { |
1103 | - if (! ($property instanceof ToOneAssociationMetadata && $property->isOwningSide())) { |
|
1103 | + if ( ! ($property instanceof ToOneAssociationMetadata && $property->isOwningSide())) { |
|
1104 | 1104 | continue; |
1105 | 1105 | } |
1106 | 1106 | |
@@ -1114,7 +1114,7 @@ discard block |
||
1114 | 1114 | |
1115 | 1115 | $weight = ! array_filter( |
1116 | 1116 | $property->getJoinColumns(), |
1117 | - function (JoinColumnMetadata $joinColumn) { return $joinColumn->isNullable(); } |
|
1117 | + function(JoinColumnMetadata $joinColumn) { return $joinColumn->isNullable(); } |
|
1118 | 1118 | ); |
1119 | 1119 | |
1120 | 1120 | $calc->addDependency($targetClass->getClassName(), $class->getClassName(), $weight); |
@@ -1408,7 +1408,7 @@ discard block |
||
1408 | 1408 | $persister = $this->getEntityPersister($class->getClassName()); |
1409 | 1409 | $id = $persister->getIdentifier($entity); |
1410 | 1410 | |
1411 | - if (! $id) { |
|
1411 | + if ( ! $id) { |
|
1412 | 1412 | return self::STATE_NEW; |
1413 | 1413 | } |
1414 | 1414 | |
@@ -1641,7 +1641,7 @@ discard block |
||
1641 | 1641 | throw ORMInvalidArgumentException::detachedEntityCannot($entity, "persisted"); |
1642 | 1642 | |
1643 | 1643 | default: |
1644 | - throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity)); |
|
1644 | + throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity)); |
|
1645 | 1645 | } |
1646 | 1646 | |
1647 | 1647 | $this->cascadePersist($entity, $visited); |
@@ -1711,7 +1711,7 @@ discard block |
||
1711 | 1711 | case self::STATE_DETACHED: |
1712 | 1712 | throw ORMInvalidArgumentException::detachedEntityCannot($entity, "removed"); |
1713 | 1713 | default: |
1714 | - throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity)); |
|
1714 | + throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity)); |
|
1715 | 1715 | } |
1716 | 1716 | |
1717 | 1717 | } |
@@ -1780,7 +1780,7 @@ discard block |
||
1780 | 1780 | $class = $this->em->getClassMetadata(get_class($entity)); |
1781 | 1781 | |
1782 | 1782 | foreach ($class->getDeclaredPropertiesIterator() as $association) { |
1783 | - if (! ($association instanceof AssociationMetadata && in_array('refresh', $association->getCascade()))) { |
|
1783 | + if ( ! ($association instanceof AssociationMetadata && in_array('refresh', $association->getCascade()))) { |
|
1784 | 1784 | continue; |
1785 | 1785 | } |
1786 | 1786 | |
@@ -1829,7 +1829,7 @@ discard block |
||
1829 | 1829 | } |
1830 | 1830 | |
1831 | 1831 | foreach ($class->getDeclaredPropertiesIterator() as $association) { |
1832 | - if (! ($association instanceof AssociationMetadata && in_array('persist', $association->getCascade()))) { |
|
1832 | + if ( ! ($association instanceof AssociationMetadata && in_array('persist', $association->getCascade()))) { |
|
1833 | 1833 | continue; |
1834 | 1834 | } |
1835 | 1835 | |
@@ -1845,7 +1845,7 @@ discard block |
||
1845 | 1845 | |
1846 | 1846 | case ($relatedEntities instanceof Collection): |
1847 | 1847 | case (is_array($relatedEntities)): |
1848 | - if (! ($association instanceof ToManyAssociationMetadata)) { |
|
1848 | + if ( ! ($association instanceof ToManyAssociationMetadata)) { |
|
1849 | 1849 | throw ORMInvalidArgumentException::invalidAssociation( |
1850 | 1850 | $this->em->getClassMetadata($targetEntity), |
1851 | 1851 | $association, |
@@ -1860,7 +1860,7 @@ discard block |
||
1860 | 1860 | break; |
1861 | 1861 | |
1862 | 1862 | case ($relatedEntities !== null): |
1863 | - if (! $relatedEntities instanceof $targetEntity) { |
|
1863 | + if ( ! $relatedEntities instanceof $targetEntity) { |
|
1864 | 1864 | throw ORMInvalidArgumentException::invalidAssociation( |
1865 | 1865 | $this->em->getClassMetadata($targetEntity), |
1866 | 1866 | $association, |
@@ -1891,7 +1891,7 @@ discard block |
||
1891 | 1891 | $class = $this->em->getClassMetadata(get_class($entity)); |
1892 | 1892 | |
1893 | 1893 | foreach ($class->getDeclaredPropertiesIterator() as $association) { |
1894 | - if (! ($association instanceof AssociationMetadata && in_array('remove', $association->getCascade()))) { |
|
1894 | + if ( ! ($association instanceof AssociationMetadata && in_array('remove', $association->getCascade()))) { |
|
1895 | 1895 | continue; |
1896 | 1896 | } |
1897 | 1897 | |
@@ -1975,7 +1975,7 @@ discard block |
||
1975 | 1975 | case LockMode::NONE === $lockMode: |
1976 | 1976 | case LockMode::PESSIMISTIC_READ === $lockMode: |
1977 | 1977 | case LockMode::PESSIMISTIC_WRITE === $lockMode: |
1978 | - if (!$this->em->getConnection()->isTransactionActive()) { |
|
1978 | + if ( ! $this->em->getConnection()->isTransactionActive()) { |
|
1979 | 1979 | throw TransactionRequiredException::transactionRequired(); |
1980 | 1980 | } |
1981 | 1981 | |
@@ -2196,7 +2196,7 @@ discard block |
||
2196 | 2196 | } |
2197 | 2197 | |
2198 | 2198 | foreach ($class->getDeclaredPropertiesIterator() as $field => $association) { |
2199 | - if (! ($association instanceof AssociationMetadata)) { |
|
2199 | + if ( ! ($association instanceof AssociationMetadata)) { |
|
2200 | 2200 | continue; |
2201 | 2201 | } |
2202 | 2202 | |
@@ -2245,7 +2245,7 @@ discard block |
||
2245 | 2245 | continue; |
2246 | 2246 | } |
2247 | 2247 | |
2248 | - if (! $association->isOwningSide()) { |
|
2248 | + if ( ! $association->isOwningSide()) { |
|
2249 | 2249 | // use the given entity association |
2250 | 2250 | if (isset($data[$field]) && is_object($data[$field]) && |
2251 | 2251 | isset($this->entityStates[spl_object_hash($data[$field])])) { |
@@ -2295,7 +2295,7 @@ discard block |
||
2295 | 2295 | $associatedId[$targetField] = $joinColumnValue; |
2296 | 2296 | } |
2297 | 2297 | |
2298 | - if (! $associatedId) { |
|
2298 | + if ( ! $associatedId) { |
|
2299 | 2299 | // Foreign key is NULL |
2300 | 2300 | $association->setValue($entity, null); |
2301 | 2301 | $this->originalEntityData[$oid][$field] = null; |
@@ -2304,7 +2304,7 @@ discard block |
||
2304 | 2304 | } |
2305 | 2305 | |
2306 | 2306 | // @todo guilhermeblanco Can we remove the need of this somehow? |
2307 | - if (!isset($hints['fetchMode'][$class->getClassName()][$field])) { |
|
2307 | + if ( ! isset($hints['fetchMode'][$class->getClassName()][$field])) { |
|
2308 | 2308 | $hints['fetchMode'][$class->getClassName()][$field] = $association->getFetchMode(); |
2309 | 2309 | } |
2310 | 2310 | |
@@ -2321,7 +2321,7 @@ discard block |
||
2321 | 2321 | // If this is an uninitialized proxy, we are deferring eager loads, |
2322 | 2322 | // this association is marked as eager fetch, and its an uninitialized proxy (wtf!) |
2323 | 2323 | // then we can append this entity for eager loading! |
2324 | - if (!$targetClass->isIdentifierComposite() && |
|
2324 | + if ( ! $targetClass->isIdentifierComposite() && |
|
2325 | 2325 | $newValue instanceof GhostObjectInterface && |
2326 | 2326 | isset($hints[self::HINT_DEFEREAGERLOAD]) && |
2327 | 2327 | $hints['fetchMode'][$class->getClassName()][$field] === FetchMode::EAGER && |
@@ -2358,7 +2358,7 @@ discard block |
||
2358 | 2358 | break; |
2359 | 2359 | |
2360 | 2360 | // Deferred eager load only works for single identifier classes |
2361 | - case (isset($hints[self::HINT_DEFEREAGERLOAD]) && !$targetClass->isIdentifierComposite()): |
|
2361 | + case (isset($hints[self::HINT_DEFEREAGERLOAD]) && ! $targetClass->isIdentifierComposite()): |
|
2362 | 2362 | // TODO: Is there a faster approach? |
2363 | 2363 | $this->eagerLoadingEntities[$targetClass->getRootClassName()][$relatedIdHash] = current($normalizedAssociatedId); |
2364 | 2364 | |
@@ -2765,7 +2765,7 @@ discard block |
||
2765 | 2765 | { |
2766 | 2766 | $class = $this->em->getClassMetadata(get_class($entity)); |
2767 | 2767 | |
2768 | - if (! $class->getProperty($propertyName)) { |
|
2768 | + if ( ! $class->getProperty($propertyName)) { |
|
2769 | 2769 | return; // ignore non-persistent fields |
2770 | 2770 | } |
2771 | 2771 | |
@@ -2905,7 +2905,7 @@ discard block |
||
2905 | 2905 | */ |
2906 | 2906 | private function afterTransactionComplete() |
2907 | 2907 | { |
2908 | - $this->performCallbackOnCachedPersister(function (CachedPersister $persister) { |
|
2908 | + $this->performCallbackOnCachedPersister(function(CachedPersister $persister) { |
|
2909 | 2909 | $persister->afterTransactionComplete(); |
2910 | 2910 | }); |
2911 | 2911 | } |
@@ -2915,7 +2915,7 @@ discard block |
||
2915 | 2915 | */ |
2916 | 2916 | private function afterTransactionRolledBack() |
2917 | 2917 | { |
2918 | - $this->performCallbackOnCachedPersister(function (CachedPersister $persister) { |
|
2918 | + $this->performCallbackOnCachedPersister(function(CachedPersister $persister) { |
|
2919 | 2919 | $persister->afterTransactionRolledBack(); |
2920 | 2920 | }); |
2921 | 2921 | } |