Skip to content

Commit 514978d

Browse files
committed
QueryResultTypeWalkerTest: fix stringification asserts
1 parent 4799f71 commit 514978d

File tree

1 file changed

+11
-25
lines changed

1 file changed

+11
-25
lines changed

tests/Type/Doctrine/Query/QueryResultTypeWalkerTest.php

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
use PHPStan\Type\StringType;
2929
use PHPStan\Type\Type;
3030
use PHPStan\Type\TypeCombinator;
31-
use PHPStan\Type\UnionType;
3231
use PHPStan\Type\VerbosityLevel;
3332
use QueryResult\Entities\Embedded;
3433
use QueryResult\Entities\JoinedChild;
@@ -553,9 +552,7 @@ public function getTestData(): iterable
553552
new ConstantIntegerType(2),
554553
TypeCombinator::union(
555554
new ConstantIntegerType(1),
556-
new ConstantIntegerType(2),
557-
new ConstantStringType('1'),
558-
new ConstantStringType('2')
555+
new ConstantIntegerType(2)
559556
),
560557
],
561558
[
@@ -1447,15 +1444,15 @@ public function getTestData(): iterable
14471444

14481445
yield 'identity function' => [
14491446
$this->constantArray([
1450-
[new ConstantIntegerType(1), TypeCombinator::addNull($this->numericStringOrInt())],
1451-
[new ConstantIntegerType(2), $this->numericStringOrInt()],
1452-
[new ConstantIntegerType(3), TypeCombinator::addNull($this->numericStringOrInt())],
1447+
[new ConstantIntegerType(1), TypeCombinator::addNull(new IntegerType())],
1448+
[new ConstantIntegerType(2), new IntegerType()],
1449+
[new ConstantIntegerType(3), TypeCombinator::addNull(new IntegerType())],
14531450
[new ConstantIntegerType(4), TypeCombinator::addNull(new StringType())],
14541451
[new ConstantIntegerType(5), TypeCombinator::addNull(new StringType())],
1455-
[new ConstantIntegerType(6), TypeCombinator::addNull($this->numericStringOrInt())],
1452+
[new ConstantIntegerType(6), TypeCombinator::addNull(new IntegerType())],
14561453
[new ConstantIntegerType(7), TypeCombinator::addNull(new MixedType())],
1457-
[new ConstantIntegerType(8), TypeCombinator::addNull($this->numericStringOrInt())],
1458-
[new ConstantIntegerType(9), TypeCombinator::addNull($this->numericStringOrInt())],
1454+
[new ConstantIntegerType(8), TypeCombinator::addNull(new IntegerType())],
1455+
[new ConstantIntegerType(9), TypeCombinator::addNull(new IntegerType())],
14591456
]),
14601457
'
14611458
SELECT IDENTITY(m.oneNull),
@@ -1474,7 +1471,7 @@ public function getTestData(): iterable
14741471

14751472
yield 'select nullable association' => [
14761473
$this->constantArray([
1477-
[new ConstantIntegerType(1), TypeCombinator::addNull($this->numericStringOrInt())],
1474+
[new ConstantIntegerType(1), TypeCombinator::addNull(new IntegerType())],
14781475
]),
14791476
'
14801477
SELECT DISTINCT(m.oneNull)
@@ -1484,7 +1481,7 @@ public function getTestData(): iterable
14841481

14851482
yield 'select non null association' => [
14861483
$this->constantArray([
1487-
[new ConstantIntegerType(1), $this->numericStringOrInt()],
1484+
[new ConstantIntegerType(1), new IntegerType()],
14881485
]),
14891486
'
14901487
SELECT DISTINCT(m.one)
@@ -1494,7 +1491,7 @@ public function getTestData(): iterable
14941491

14951492
yield 'select default nullability association' => [
14961493
$this->constantArray([
1497-
[new ConstantIntegerType(1), TypeCombinator::addNull($this->numericStringOrInt())],
1494+
[new ConstantIntegerType(1), TypeCombinator::addNull(new IntegerType())],
14981495
]),
14991496
'
15001497
SELECT DISTINCT(m.oneDefaultNullability)
@@ -1504,7 +1501,7 @@ public function getTestData(): iterable
15041501

15051502
yield 'select non null association in aggregated query' => [
15061503
$this->constantArray([
1507-
[new ConstantIntegerType(1), TypeCombinator::addNull($this->numericStringOrInt())],
1504+
[new ConstantIntegerType(1), TypeCombinator::addNull(new IntegerType())],
15081505
[
15091506
new ConstantIntegerType(2),
15101507
$this->uint(),
@@ -1572,17 +1569,6 @@ private function constantArray(array $elements): Type
15721569
return $builder->getArray();
15731570
}
15741571

1575-
private function numericStringOrInt(): Type
1576-
{
1577-
return new UnionType([
1578-
new IntegerType(),
1579-
new IntersectionType([
1580-
new StringType(),
1581-
new AccessoryNumericStringType(),
1582-
]),
1583-
]);
1584-
}
1585-
15861572
private function numericString(): Type
15871573
{
15881574
return new IntersectionType([

0 commit comments

Comments
 (0)