Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c7dfd1e

Browse files
Wip
1 parent 0d88669 commit c7dfd1e

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

‎composer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
],
88
"require": {
99
"php": "^7.2 || ^8.0",
10-
"phpstan/phpstan": "^1.12"
10+
"phpstan/phpstan": "1.12.6"
1111
},
1212
"conflict": {
1313
"doctrine/collections": "<1.0",

‎tests/Type/Doctrine/Query/QueryResultTypeWalkerHydrationModeTest.php‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use PHPStan\Php\PhpVersion;
1212
use PHPStan\Testing\PHPStanTestCase;
1313
use PHPStan\Type\Accessory\AccessoryArrayListType;
14+
use PHPStan\Type\Accessory\AccessoryLowercaseStringType;
1415
use PHPStan\Type\Accessory\AccessoryNumericStringType;
1516
use PHPStan\Type\ArrayType;
1617
use PHPStan\Type\Constant\ConstantArrayTypeBuilder;
@@ -308,12 +309,17 @@ private static function list(Type $values): Type
308309
return AccessoryArrayListType::intersectWith(new ArrayType(new IntegerType(), $values));
309310
}
310311

311-
private static function numericString(): Type
312+
private static function numericString(bool$lowercase = false): Type
312313
{
313-
returnnewIntersectionType([
314+
$types = [
314315
new StringType(),
315316
new AccessoryNumericStringType(),
316-
]);
317+
];
318+
if ($lowercase) {
319+
$types[] = new AccessoryLowercaseStringType();
320+
}
321+
322+
return new IntersectionType($types);
317323
}
318324

319325
/**

‎tests/Type/Doctrine/Query/QueryResultTypeWalkerTest.php‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use PHPStan\Php\PhpVersion;
1616
use PHPStan\Testing\PHPStanTestCase;
1717
use PHPStan\Type\Accessory\AccessoryArrayListType;
18+
use PHPStan\Type\Accessory\AccessoryLowercaseStringType;
1819
use PHPStan\Type\Accessory\AccessoryNumericStringType;
1920
use PHPStan\Type\ArrayType;
2021
use PHPStan\Type\Constant\ConstantArrayTypeBuilder;
@@ -1474,7 +1475,7 @@ public function getTestData(): iterable
14741475
$this->constantArray([
14751476
[new ConstantStringType('minusInt'), $this->stringifies() ? new ConstantStringType('-1') : new ConstantIntegerType(-1)],
14761477
[new ConstantStringType('minusFloat'), $this->stringifies() ? $this->numericString() : new ConstantFloatType(-0.1)],
1477-
[new ConstantStringType('minusIntRange'), $this->stringifies() ? $this->numericString() : IntegerRangeType::fromInterval(null, 0)],
1478+
[new ConstantStringType('minusIntRange'), $this->stringifies() ? $this->numericString(true) : IntegerRangeType::fromInterval(null, 0)],
14781479
]),
14791480
'
14801481
SELECT -1 as minusInt,
@@ -1622,12 +1623,17 @@ private function constantArray(array $elements): Type
16221623
return $builder->getArray();
16231624
}
16241625

1625-
private function numericString(): Type
1626+
private function numericString(bool$lowercase = false): Type
16261627
{
1627-
returnnewIntersectionType([
1628+
$types = [
16281629
new StringType(),
16291630
new AccessoryNumericStringType(),
1630-
]);
1631+
];
1632+
if ($lowercase) {
1633+
$types[] = new AccessoryLowercaseStringType();
1634+
}
1635+
1636+
return new IntersectionType($types);
16311637
}
16321638

16331639
private function uint(): Type
@@ -1673,14 +1679,14 @@ private function stringifies(): bool
16731679
private function intOrStringified(): Type
16741680
{
16751681
return $this->stringifies()
1676-
? $this->numericString()
1682+
? $this->numericString(true)
16771683
: new IntegerType();
16781684
}
16791685

16801686
private function uintOrStringified(): Type
16811687
{
16821688
return $this->stringifies()
1683-
? $this->numericString()
1689+
? $this->numericString(true)
16841690
: $this->uint();
16851691
}
16861692

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /