diff --git a/src/Psalm/Internal/Analyzer/CommentAnalyzer.php b/src/Psalm/Internal/Analyzer/CommentAnalyzer.php index fb16a6fce98..e9572f41318 100644 --- a/src/Psalm/Internal/Analyzer/CommentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/CommentAnalyzer.php @@ -237,10 +237,7 @@ private static function decorateVarDocblockComment( } $var_comment->psalm_internal = reset($parsed_docblock->tags['psalm-internal']); - - if (!$var_comment->internal) { - throw new DocblockParseException('@psalm-internal annotation used without @internal'); - } + $var_comment->internal = true; } } @@ -627,10 +624,7 @@ public static function extractFunctionDocblockInfo(PhpParser\Comment\Doc $commen throw new DocblockParseException('@psalm-internal annotation used without specifying namespace'); } $info->psalm_internal = reset($parsed_docblock->tags['psalm-internal']); - - if (! $info->internal) { - throw new DocblockParseException('@psalm-internal annotation used without @internal'); - } + $info->internal = true; } if (isset($parsed_docblock->tags['psalm-suppress'])) { @@ -926,9 +920,7 @@ public static function extractClassLikeDocblockInfo( throw new DocblockParseException('psalm-internal annotation used without specifying namespace'); } - if (! $info->internal) { - throw new DocblockParseException('@psalm-internal annotation used without @internal'); - } + $info->internal = true; } if (isset($parsed_docblock->tags['mixin'])) { diff --git a/tests/InternalAnnotationTest.php b/tests/InternalAnnotationTest.php index d8441cf2e29..7b6b8774f91 100644 --- a/tests/InternalAnnotationTest.php +++ b/tests/InternalAnnotationTest.php @@ -262,7 +262,6 @@ public function batBat() : void { namespace A\B { class Foo { /** - * @internal * @psalm-internal A\B */ public static function barBar(): void { @@ -283,7 +282,6 @@ public function batBat() : void { namespace A\B { class Foo { /** - * @internal * @psalm-internal A\B */ public static function barBar(): void { @@ -304,7 +302,6 @@ public function batBat() : void { namespace A\B { class Foo { /** - * @internal * @psalm-internal A\B */ public static function barBar(): void { @@ -320,7 +317,6 @@ public static function foo(): void { ' 'psalm-internal annotation used without specifying namespace', ], - 'psalmInternalClassMissingInternalAnnotation' => [ - ' 'psalm-internal annotation used without @internal', - ], - 'psalmInternalPropertyMissingInternalAnnotation' => [ - ' 'psalm-internal annotation used without @internal', - ], - 'psalmInternalFunctionMissingInternalAnnotation' => [ - ' 'psalm-internal annotation used without @internal', - ], ]; } }