Skip to content

Commit d289ca6

Browse files
committed
Update typhoon/type
1 parent d5eeb1a commit d289ca6

File tree

5 files changed

+25
-15
lines changed

5 files changed

+25
-15
lines changed

composer.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Internal/ContextualTypeParser.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@
4040
use const Typhoon\Type\nonEmptyStringT;
4141
use const Typhoon\Type\nonNegativeIntT;
4242
use const Typhoon\Type\nonPositiveIntT;
43+
use const Typhoon\Type\nonZeroIntT;
4344
use const Typhoon\Type\nullT;
45+
use const Typhoon\Type\numericStringT;
46+
use const Typhoon\Type\numericT;
4447
use const Typhoon\Type\positiveIntT;
4548
use const Typhoon\Type\resourceT;
4649
use const Typhoon\Type\scalarT;
@@ -116,12 +119,14 @@ private function parseIdentifier(string $name, array $genericNodes = []): Type
116119
'negative-int' => negativeIntT,
117120
'non-negative-int' => nonNegativeIntT,
118121
'non-positive-int' => nonPositiveIntT,
119-
'non-zero-int' => orT(negativeIntT, positiveIntT),
122+
'non-zero-int' => nonZeroIntT,
120123
'float' => self::parseFloat(...),
121-
'string' => stringT,
122124
'non-empty-string' => nonEmptyStringT,
125+
'numeric-string' => numericStringT,
126+
'string' => stringT,
123127
'resource' => resourceT,
124128
'array-key' => arrayKeyT,
129+
'numeric' => numericT,
125130
'scalar' => scalarT,
126131
'mixed' => mixedT,
127132
];

tests/PHPStanTypeParserTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
use const Typhoon\Type\nonEmptyStringT;
3030
use const Typhoon\Type\nonNegativeIntT;
3131
use const Typhoon\Type\nonPositiveIntT;
32+
use const Typhoon\Type\nonZeroIntT;
3233
use const Typhoon\Type\nullT;
34+
use const Typhoon\Type\numericStringT;
35+
use const Typhoon\Type\numericT;
3336
use const Typhoon\Type\positiveIntT;
3437
use const Typhoon\Type\resourceT;
3538
use const Typhoon\Type\scalarT;
@@ -60,7 +63,7 @@ private static function cases(): \Generator
6063
yield 'negative-int' => negativeIntT;
6164
yield 'non-positive-int' => nonPositiveIntT;
6265
yield 'non-negative-int' => nonNegativeIntT;
63-
yield 'non-zero-int' => orT(negativeIntT, positiveIntT);
66+
yield 'non-zero-int' => nonZeroIntT;
6467
yield 'int<0, 1>' => intRangeT(0, 1);
6568
yield 'int<-10, -23>' => intRangeT(-10, -23);
6669
yield 'int<min, 123>' => intRangeT(max: 123);
@@ -80,10 +83,12 @@ private static function cases(): \Generator
8083
yield '"str"' => stringT('str');
8184
yield "'str'" => stringT('str');
8285
yield "'\\n'" => stringT('\n');
83-
yield 'string' => stringT;
8486
yield 'non-empty-string' => nonEmptyStringT;
87+
yield 'numeric-string' => numericStringT;
88+
yield 'string' => stringT;
8589
yield 'resource' => resourceT;
8690
yield 'array-key' => arrayKeyT;
91+
yield 'numeric' => numericT;
8792
yield 'scalar' => scalarT;
8893
yield 'int|string' => orT(intT, stringT);
8994
yield '(int|string)|float' => orT(orT(intT, stringT), floatT);

tools/phpstan/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"require-dev": {
3-
"phpstan/phpstan": "^2.1.8"
3+
"phpstan/phpstan": "^2.1.11"
44
},
55
"config": {
66
"bump-after-update": "dev",

tools/phpstan/composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)