Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.20.x' into 3.3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Dec 7, 2024
2 parents 360b80a + 6fd26a3 commit b7d1a74
Show file tree
Hide file tree
Showing 8 changed files with 1,300 additions and 588 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"phpbench/phpbench": "^1.0",
"phpdocumentor/guides-cli": "^1.4",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "1.12.6",
"phpstan/phpstan-deprecation-rules": "^1.2",
"phpstan/phpstan": "2.0.3",
"phpstan/phpstan-deprecation-rules": "^2",
"phpunit/phpunit": "^10.4.0",
"psr/log": "^1 || ^2 || ^3",
"squizlabs/php_codesniffer": "3.7.2",
Expand Down
1,861 changes: 1,291 additions & 570 deletions phpstan-baseline.neon

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion phpstan-params.neon
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ parameters:
earlyTerminatingMethodCalls:
Doctrine\ORM\Query\Parser:
- syntaxError
phpVersion: 80200
phpVersion: 80400
1 change: 0 additions & 1 deletion src/Cache/DefaultQueryCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ public function put(QueryCacheKey $key, ResultSetMapping $rsm, mixed $result, ar
$region = $persister->getCacheRegion();

$cm = $this->em->getClassMetadata($entityName);
assert($cm instanceof ClassMetadata);

foreach ($result as $index => $entity) {
$identifier = $this->uow->getEntityIdentifier($entity);
Expand Down
10 changes: 5 additions & 5 deletions src/Cache/Persister/Entity/AbstractEntityPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
use Doctrine\ORM\UnitOfWork;

use function array_merge;
use function assert;
use function serialize;
use function sha1;

Expand Down Expand Up @@ -549,9 +548,10 @@ public function refresh(array $id, object $entity, LockMode|int|null $lockMode =
/** @param array<string, mixed> $ownerId */
protected function buildCollectionCacheKey(AssociationMapping $association, array $ownerId): CollectionCacheKey
{
$metadata = $this->metadataFactory->getMetadataFor($association->sourceEntity);
assert($metadata instanceof ClassMetadata);

return new CollectionCacheKey($metadata->rootEntityName, $association->fieldName, $ownerId);
return new CollectionCacheKey(
$this->metadataFactory->getMetadataFor($association->sourceEntity)->rootEntityName,
$association->fieldName,
$ownerId,
);
}
}
2 changes: 0 additions & 2 deletions src/Mapping/DefaultTypedFieldMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ public function validateAndComplete(array $mapping, ReflectionProperty $field):
assert(is_a($type->getName(), BackedEnum::class, true));
$mapping['enumType'] = $type->getName();
$type = $reflection->getBackingType();

assert($type instanceof ReflectionNamedType);
}

if (isset($mapping['type'])) {
Expand Down
7 changes: 0 additions & 7 deletions src/Mapping/Driver/AttributeDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use InvalidArgumentException;
use ReflectionClass;
use ReflectionMethod;
use ReflectionProperty;

use function assert;
use function class_exists;
Expand Down Expand Up @@ -273,8 +272,6 @@ public function loadMetadataForClass(string $className, PersistenceClassMetadata
}

foreach ($reflectionClass->getProperties() as $property) {
assert($property instanceof ReflectionProperty);

if ($this->isRepeatedPropertyDeclaration($property, $metadata)) {
continue;
}
Expand All @@ -285,8 +282,6 @@ public function loadMetadataForClass(string $className, PersistenceClassMetadata
// Evaluate #[Cache] attribute
$cacheAttribute = $this->reader->getPropertyAttribute($property, Mapping\Cache::class);
if ($cacheAttribute !== null) {
assert($cacheAttribute instanceof Mapping\Cache);

$mapping['cache'] = $metadata->getAssociationCacheDefaults(
$mapping['fieldName'],
[
Expand Down Expand Up @@ -560,7 +555,6 @@ public function loadMetadataForClass(string $className, PersistenceClassMetadata
$listenerClass = new ReflectionClass($listenerClassName);

foreach ($listenerClass->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
assert($method instanceof ReflectionMethod);
// find method callbacks.
$callbacks = $this->getMethodCallbacks($method);
$hasMapping = $hasMapping ?: ! empty($callbacks);
Expand All @@ -584,7 +578,6 @@ public function loadMetadataForClass(string $className, PersistenceClassMetadata
}

foreach ($reflectionClass->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
assert($method instanceof ReflectionMethod);
foreach ($this->getMethodCallbacks($method) as $value) {
$metadata->addLifecycleCallback($value[0], $value[1]);
}
Expand Down
1 change: 1 addition & 0 deletions tests/Tests/ORM/Functional/QueryDqlFunctionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ public function testInArithmeticExpression1(): void
SELECT m, m.name AS m_name
FROM Doctrine\Tests\Models\Company\CompanyManager m
WHERE m.salary IN (800000 / 8, 100000 * 2)
ORDER BY m.name DESC
SQL;

$result = $this->_em->createQuery($dql)->getArrayResult();
Expand Down

0 comments on commit b7d1a74

Please sign in to comment.