28
28
use PHPStan \Type \StringType ;
29
29
use PHPStan \Type \Type ;
30
30
use PHPStan \Type \TypeCombinator ;
31
- use PHPStan \Type \UnionType ;
32
31
use PHPStan \Type \VerbosityLevel ;
33
32
use QueryResult \Entities \Embedded ;
34
33
use QueryResult \Entities \JoinedChild ;
@@ -553,9 +552,7 @@ public function getTestData(): iterable
553
552
new ConstantIntegerType (2 ),
554
553
TypeCombinator::union (
555
554
new ConstantIntegerType (1 ),
556
- new ConstantIntegerType (2 ),
557
- new ConstantStringType ('1 ' ),
558
- new ConstantStringType ('2 ' )
555
+ new ConstantIntegerType (2 )
559
556
),
560
557
],
561
558
[
@@ -1447,15 +1444,15 @@ public function getTestData(): iterable
1447
1444
1448
1445
yield 'identity function ' => [
1449
1446
$ 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 ())],
1453
1450
[new ConstantIntegerType (4 ), TypeCombinator::addNull (new StringType ())],
1454
1451
[new ConstantIntegerType (5 ), TypeCombinator::addNull (new StringType ())],
1455
- [new ConstantIntegerType (6 ), TypeCombinator::addNull ($ this -> numericStringOrInt ())],
1452
+ [new ConstantIntegerType (6 ), TypeCombinator::addNull (new IntegerType ())],
1456
1453
[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 ())],
1459
1456
]),
1460
1457
'
1461
1458
SELECT IDENTITY(m.oneNull),
@@ -1474,7 +1471,7 @@ public function getTestData(): iterable
1474
1471
1475
1472
yield 'select nullable association ' => [
1476
1473
$ this ->constantArray ([
1477
- [new ConstantIntegerType (1 ), TypeCombinator::addNull ($ this -> numericStringOrInt ())],
1474
+ [new ConstantIntegerType (1 ), TypeCombinator::addNull (new IntegerType ())],
1478
1475
]),
1479
1476
'
1480
1477
SELECT DISTINCT(m.oneNull)
@@ -1484,7 +1481,7 @@ public function getTestData(): iterable
1484
1481
1485
1482
yield 'select non null association ' => [
1486
1483
$ this ->constantArray ([
1487
- [new ConstantIntegerType (1 ), $ this -> numericStringOrInt ()],
1484
+ [new ConstantIntegerType (1 ), new IntegerType ()],
1488
1485
]),
1489
1486
'
1490
1487
SELECT DISTINCT(m.one)
@@ -1494,7 +1491,7 @@ public function getTestData(): iterable
1494
1491
1495
1492
yield 'select default nullability association ' => [
1496
1493
$ this ->constantArray ([
1497
- [new ConstantIntegerType (1 ), TypeCombinator::addNull ($ this -> numericStringOrInt ())],
1494
+ [new ConstantIntegerType (1 ), TypeCombinator::addNull (new IntegerType ())],
1498
1495
]),
1499
1496
'
1500
1497
SELECT DISTINCT(m.oneDefaultNullability)
@@ -1504,7 +1501,7 @@ public function getTestData(): iterable
1504
1501
1505
1502
yield 'select non null association in aggregated query ' => [
1506
1503
$ this ->constantArray ([
1507
- [new ConstantIntegerType (1 ), TypeCombinator::addNull ($ this -> numericStringOrInt ())],
1504
+ [new ConstantIntegerType (1 ), TypeCombinator::addNull (new IntegerType ())],
1508
1505
[
1509
1506
new ConstantIntegerType (2 ),
1510
1507
$ this ->uint (),
@@ -1572,17 +1569,6 @@ private function constantArray(array $elements): Type
1572
1569
return $ builder ->getArray ();
1573
1570
}
1574
1571
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
-
1586
1572
private function numericString (): Type
1587
1573
{
1588
1574
return new IntersectionType ([
0 commit comments