Skip to content

Commit f09313d

Browse files
committed
Improve linter stubs
1 parent cae9afb commit f09313d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

tests/Functional/LinterStubs/LinterStubsTestCase.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use TypeLang\PHPDoc\Tag\InvalidTag;
1717
use TypeLang\PHPDoc\Tag\TagInterface;
1818
use TypeLang\PHPDoc\Standard;
19-
use TypeLang\PHPDoc\Tag\TypeProviderInterface;
2019

2120
#[Group('functional'), Group('type-lang/parser')]
2221
abstract class LinterStubsTestCase extends TestCase
@@ -90,8 +89,6 @@ protected static function getAllTags(): iterable
9089
\mkdir($directory, recursive: true);
9190
}
9291

93-
$types = [];
94-
9592
foreach (self::getFiles() as $name => $pathname) {
9693
$cache = $directory . '/' . \str_replace(['/', '\\'], '-', $name) . '.cache';
9794

@@ -156,13 +153,16 @@ public static function paramTagDataProvider(): iterable
156153
#[DataProvider('paramTagDataProvider')]
157154
public function testParamStatementsIsCorrectlyRecognized(TagInterface $tag): void
158155
{
159-
// TODO Known phpdoc parser issue for variadic or optional variables
160-
$this->skipInCaseOfReasonPhraseContains($tag, 'contains an incorrect variable name');
156+
// PHPStan SplObjectStorage docblock bug?
157+
$this->skipInCaseOfReasonPhraseContains($tag, 'contains an incorrect variable name:'
158+
. ' \SplObjectStorage<*, *> $storage');
161159

162-
// TODO Known phpdoc parser issue for non-typed @param tags
163-
$this->skipInCaseOfReasonPhraseContains($tag, 'type: &$info [optional]');
164-
$this->skipInCaseOfReasonPhraseContains($tag, 'type: &$composed [optional]');
165-
$this->skipInCaseOfReasonPhraseContains($tag, 'type: &$result [optional]');
160+
// Psalm redis docblock bug (param tag does not provide variable name)
161+
$this->skipInCaseOfReasonPhraseContains($tag, 'contains an incorrect variable name:'
162+
. ' array<int|string, string>');
163+
// Known phpdoc bug
164+
$this->skipInCaseOfReasonPhraseContains($tag, 'contains an incorrect variable name:'
165+
. ' $1 $2');
166166

167167
self::assertInstanceOf(Standard\ParamTag::class, $tag,
168168
message: self::getReasonPhrase($tag),
@@ -238,7 +238,7 @@ public function testThrowsStatementsIsCorrectlyRecognized(TagInterface $tag): vo
238238
);
239239
}
240240

241-
private static function getReasonPhrase(TagInterface $tag): string
241+
protected static function getReasonPhrase(TagInterface $tag): string
242242
{
243243
if ($tag instanceof InvalidTag) {
244244
$reason = $tag->getReason();
@@ -249,7 +249,7 @@ private static function getReasonPhrase(TagInterface $tag): string
249249
return 'Failed to parse tag: ' . \print_r($tag, true);
250250
}
251251

252-
private static function skipInCaseOfReasonPhraseContains(TagInterface $tag, string $message): void
252+
protected static function skipInCaseOfReasonPhraseContains(TagInterface $tag, string $message): void
253253
{
254254
if (!$tag instanceof InvalidTag) {
255255
return;

0 commit comments

Comments
 (0)