Skip to content

Commit e8900d4

Browse files
Simplify
1 parent 42c4b04 commit e8900d4

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

Diff for: src/Type/Doctrine/Query/QueryResultTypeWalker.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -944,11 +944,8 @@ public function walkAggregateExpression($aggExpression): string
944944
$this->walkSimpleArithmeticExpression($aggExpression->pathExpression)
945945
);
946946

947-
if (count($type->getConstantScalarValues()) !== 1) {
948-
$type = TypeUtils::generalizeType($type, GeneralizePrecision::lessSpecific());
949-
}
950-
951-
$type = TypeCombinator::union($type, $type->toFloat(), $type->toFloat()->toString());
947+
$type = TypeCombinator::union($type, $type->toFloat());
948+
$type = TypeUtils::generalizeType($type, GeneralizePrecision::lessSpecific());
952949

953950
return $this->marshalType(TypeCombinator::addNull($type));
954951

Diff for: tests/Type/Doctrine/Query/QueryResultTypeWalkerTest.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -723,10 +723,8 @@ public function getTestData(): iterable
723723
[
724724
new ConstantIntegerType(5),
725725
TypeCombinator::union(
726-
new ConstantStringType('1'),
727-
new ConstantIntegerType(1),
728-
new ConstantStringType('1.0'),
729-
new ConstantFloatType(1.0),
726+
$this->intStringified(),
727+
new FloatType(),
730728
new NullType()
731729
),
732730
],

0 commit comments

Comments
 (0)