Skip to content

Commit

Permalink
Improve linter stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
SerafimArts committed Apr 12, 2024
1 parent cae9afb commit f09313d
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tests/Functional/LinterStubs/LinterStubsTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use TypeLang\PHPDoc\Tag\InvalidTag;
use TypeLang\PHPDoc\Tag\TagInterface;
use TypeLang\PHPDoc\Standard;
use TypeLang\PHPDoc\Tag\TypeProviderInterface;

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

$types = [];

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

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

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

self::assertInstanceOf(Standard\ParamTag::class, $tag,
message: self::getReasonPhrase($tag),
Expand Down Expand Up @@ -238,7 +238,7 @@ public function testThrowsStatementsIsCorrectlyRecognized(TagInterface $tag): vo
);
}

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

private static function skipInCaseOfReasonPhraseContains(TagInterface $tag, string $message): void
protected static function skipInCaseOfReasonPhraseContains(TagInterface $tag, string $message): void
{
if (!$tag instanceof InvalidTag) {
return;
Expand Down

0 comments on commit f09313d

Please sign in to comment.