8000 [PropertyInfo] Add non-*-int missing types for PhpStanExtractor · symfony/symfony@a08658d · GitHub
[go: up one dir, main page]

Skip to content

Commit a08658d

Browse files
committed
[PropertyInfo] Add non-*-int missing types for PhpStanExtractor
1 parent dd882db commit a08658d

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,9 @@ public static function provideLegacyPseudoTypes(): array
459459
['literalString', [new LegacyType(LegacyType::BUILTIN_TYPE_STRING, false, null)]],
460460
['positiveInt', [new LegacyType(LegacyType::BUILTIN_TYPE_INT, false, null)]],
461461
['negativeInt', [new LegacyType(LegacyType::BUILTIN_TYPE_INT, false, null)]],
462+
['nonPositiveInt', [new LegacyType(LegacyType::BUILTIN_TYPE_INT, false, null)]],
463+
['nonNegativeInt', [new LegacyType(LegacyType::BUILTIN_TYPE_INT, false, null)]],
464+
['nonZeroInt', [new LegacyType(LegacyType::BUILTIN_TYPE_INT, false, null)]],
462465
['nonEmptyArray', [new LegacyType(LegacyType::BUILTIN_TYPE_ARRAY, false, null, true)]],
463466
['nonEmptyList', [new LegacyType(LegacyType::BUILTIN_TYPE_ARRAY, false, null, true, new LegacyType(LegacyType::BUILTIN_TYPE_INT))]],
464467
['scalar', [new LegacyType(LegacyType::BUILTIN_TYPE_INT), new LegacyType(LegacyType::BUILTIN_TYPE_FLOAT), new LegacyType(LegacyType::BUILTIN_TYPE_STRING), new LegacyType(LegacyType::BUILTIN_TYPE_BOOL)]],

src/Symfony/Component/PropertyInfo/Tests/Fixtures/PhpStanPseudoTypesDummy.php

+9
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ class PhpStanPseudoTypesDummy extends PseudoTypesDummy
1919
/** @var negative-int */
2020
public $negativeInt;
2121

22+
/** @var non-positive-int */
23+
public $nonPositiveInt;
24+
25+
/** @var non-negative-int */
26+
public $nonNegativeInt;
27+
28+
/** @var non-zero-int */
29+
public $nonZeroInt;
30+
2231
/** @var non-empty-array */
2332
public $nonEmptyArray;
2433

src/Symfony/Component/PropertyInfo/Util/PhpStanTypeHelper.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,10 @@ private function extractTypes(TypeNode $node, NameScope $nameScope): array
179179
return match ($node->name) {
180180
'integer',
181181
'positive-int',
182-
'negative-int' => [new Type(Type::BUILTIN_TYPE_INT)],
182+
'negative-int',
183+
'non-positive-int',
184+
'non-negative-int',
185+
'non-zero-int' => [new Type(Type::BUILTIN_TYPE_INT)],
183186
'double' => [new Type(Type::BUILTIN_TYPE_FLOAT)],
184187
'list',
185188
'non-empty-list' => [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT))],

0 commit comments

Comments
 (0)
0