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

Appearance settings

Commit ccf91a1

Browse filesBrowse files
committed
feature #59192 [PropertyInfo] Add non-*-int missing types for PhpStanExtractor (wuchen90)
This PR was merged into the 7.3 branch. Discussion ---------- [PropertyInfo] Add non-*-int missing types for PhpStanExtractor | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | yes | Deprecations? | no | License | MIT This PR adds support for following PHPStan types in Property Info component: - `non-positive-int` - `non-negative-int` - `non-zero-int` See PHPStan official docs for these types: https://phpstan.org/writing-php-code/phpdoc-types#integer-ranges Commits ------- 761bb04 [PropertyInfo] Add non-*-int missing types for PhpStanExtractor
2 parents 94a156f + 761bb04 commit ccf91a1
Copy full SHA for ccf91a1

File tree

Expand file treeCollapse file tree

4 files changed

+21
-1
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+21
-1
lines changed

‎src/Symfony/Component/PropertyInfo/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyInfo/CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
7.3
5+
---
6+
7+
* Add support for `non-positive-int`, `non-negative-int` and `non-zero-int` PHPStan types to `PhpStanExtractor`
8+
49
7.1
510
---
611

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php
+3Lines changed: 3 additions & 0 deletions
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

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyInfo/Tests/Fixtures/PhpStanPseudoTypesDummy.php
+9Lines changed: 9 additions & 0 deletions
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

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyInfo/Util/PhpStanTypeHelper.php
+4-1Lines changed: 4 additions & 1 deletion
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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.