Skip to content

Commit 9d7b03d

Browse files
committed
Fix CheckVisibilityPlugin to check interfaces
1 parent 3db07fa commit 9d7b03d

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

tests/Reflection/Internal/NativeReflector/DefinedConstantReflectorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public static function definedConstantsWithoutNAN(): \Generator
4545

4646
yield $name => [Id::constant($name), $extension, $value];
4747

48-
return ;
48+
return;
4949
}
5050
}
5151
}

tools/psalm/src/CheckVisibilityPlugin.php

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,28 @@
88
use Psalm\CodeLocation;
99
use Psalm\Issue\PluginIssue;
1010
use Psalm\IssueBuffer;
11-
use Psalm\Plugin\EventHandler\AfterClassLikeAnalysisInterface;
11+
use Psalm\Plugin\EventHandler\AfterClassLikeVisitInterface;
1212
use Psalm\Plugin\EventHandler\AfterFunctionLikeAnalysisInterface;
13-
use Psalm\Plugin\EventHandler\Event\AfterClassLikeAnalysisEvent;
13+
use Psalm\Plugin\EventHandler\Event\AfterClassLikeVisitEvent;
1414
use Psalm\Plugin\EventHandler\Event\AfterFunctionLikeAnalysisEvent;
1515
use Psalm\Plugin\PluginEntryPointInterface;
1616
use Psalm\Plugin\RegistrationInterface;
1717

1818
/**
1919
* @psalm-suppress UnusedClass
2020
*/
21-
final class CheckVisibilityPlugin implements PluginEntryPointInterface, AfterClassLikeAnalysisInterface
21+
final class CheckVisibilityPlugin implements PluginEntryPointInterface, AfterClassLikeVisitInterface
2222
{
23-
public static function afterStatementAnalysis(AfterClassLikeAnalysisEvent $event): ?bool
23+
public static function afterClassLikeVisit(AfterClassLikeVisitEvent $event): void
2424
{
25-
$class = $event->getClasslikeStorage();
25+
$class = $event->getStorage();
2626

2727
if ($event->getStmt()->name !== null && !$class->internal && !$class->public_api) {
28-
IssueBuffer::accepts(
29-
new UnspecifiedVisibility(
30-
'Class ' . $class->name,
31-
$class->location ?? new CodeLocation($event->getStatementsSource(), $event->getStmt()),
32-
),
33-
$event->getStatementsSource()->getSuppressedIssues(),
28+
$class->docblock_issues[] = new UnspecifiedVisibility(
29+
'Class ' . $class->name,
30+
$class->location ?? new CodeLocation($event->getStatementsSource(), $event->getStmt()),
3431
);
3532
}
36-
37-
return null;
3833
}
3934

4035
public function __invoke(RegistrationInterface $registration, ?\SimpleXMLElement $config = null): void

0 commit comments

Comments
 (0)