Skip to content

Commit ca91db8

Browse files
Reduce big int type from string to numeric-string
1 parent 964caf8 commit ca91db8

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/Type/Doctrine/Descriptors/BigIntType.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace PHPStan\Type\Doctrine\Descriptors;
44

5+
use PHPStan\Type\Accessory\AccessoryNumericStringType;
56
use PHPStan\Type\IntegerType;
67
use PHPStan\Type\StringType;
78
use PHPStan\Type\Type;
@@ -17,7 +18,7 @@ public function getType(): string
1718

1819
public function getWritableToPropertyType(): Type
1920
{
20-
return new StringType();
21+
return TypeCombinator::intersect(new StringType(), new AccessoryNumericStringType());
2122
}
2223

2324
public function getWritableToDatabaseType(): Type

tests/Type/Doctrine/Query/QueryResultTypeWalkerTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ public function getTestData(): iterable
349349
]),
350350
$this->constantArray([
351351
[new ConstantIntegerType(0), new ObjectType(One::class)],
352-
[new ConstantStringType('id'), new StringType()],
352+
[new ConstantStringType('id'), $this->numericString()],
353353
[new ConstantStringType('intColumn'), new IntegerType()],
354354
])
355355
),
@@ -371,7 +371,7 @@ public function getTestData(): iterable
371371
]),
372372
$this->constantArray([
373373
[new ConstantIntegerType(0), new ObjectType(Many::class)],
374-
[new ConstantStringType('id'), new StringType()],
374+
[new ConstantStringType('id'), $this->numericString()],
375375
[new ConstantStringType('intColumn'), new IntegerType()],
376376
])
377377
),
@@ -392,7 +392,7 @@ public function getTestData(): iterable
392392
]),
393393
$this->constantArray([
394394
[new ConstantStringType('one'), new ObjectType(One::class)],
395-
[new ConstantStringType('id'), new StringType()],
395+
[new ConstantStringType('id'), $this->numericString()],
396396
[new ConstantStringType('intColumn'), new IntegerType()],
397397
])
398398
),
@@ -502,7 +502,7 @@ public function getTestData(): iterable
502502
yield 'just root entity and scalars' => [
503503
$this->constantArray([
504504
[new ConstantIntegerType(0), new ObjectType(One::class)],
505-
[new ConstantStringType('id'), new StringType()],
505+
[new ConstantStringType('id'), $this->numericString()],
506506
]),
507507
'
508508
SELECT o, o.id

0 commit comments

Comments
 (0)