Skip to content

Navigation Menu

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 fa844c5

Browse filesBrowse files
committed
bug #59924 Extract no type @param annotation with PhpStanExtractor (thomasdubuffet)
This PR was merged into the 7.2 branch. Discussion ---------- Extract no type ``@param`` annotation with `PhpStanExtractor` | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #59923 | License | MIT Commits ------- 03372e8 fix: extract no type ``@param`` annotation with `PhpStanExtractor`
2 parents 653e42d + 03372e8 commit fa844c5
Copy full SHA for fa844c5

File tree

3 files changed

+11
-1
lines changed
Filter options

3 files changed

+11
-1
lines changed

‎src/Symfony/Component/PropertyInfo/Extractor/PhpStanExtractor.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyInfo/Extractor/PhpStanExtractor.php
+3-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
1717
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
1818
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
19+
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
20+
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
1921
use PHPStan\PhpDocParser\Lexer\Lexer;
2022
use PHPStan\PhpDocParser\Parser\ConstExprParser;
2123
use PHPStan\PhpDocParser\Parser\PhpDocParser;
@@ -206,7 +208,7 @@ public function getType(string $class, string $property, array $context = []): ?
206208
$types = [];
207209

208210
foreach ($docNode->getTagsByName($tag) as $tagDocNode) {
209-
if ($tagDocNode->value instanceof InvalidTagValueNode) {
211+
if (!$tagDocNode->value instanceof ParamTagValueNode && !$tagDocNode->value instanceof ReturnTagValueNode && !$tagDocNode->value instanceof VarTagValueNode) {
210212
continue;
211213
}
212214

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php
+1
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,7 @@ public static function invalidTypesProvider(): iterable
694694
yield 'stat' => ['stat'];
695695
yield 'foo' => ['foo'];
696696
yield 'bar' => ['bar'];
697+
yield 'baz' => ['baz'];
697698
}
698699

699700
/**

‎src/Symfony/Component/PropertyInfo/Tests/Fixtures/InvalidDummy.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyInfo/Tests/Fixtures/InvalidDummy.php
+7
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,11 @@ public function getBar()
4747
{
4848
return 'bar';
4949
}
50+
51+
/**
52+
* @param $baz
53+
*/
54+
public function setBaz($baz)
55+
{
56+
}
5057
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.