From 819b3126d31f93ad0d8f14a195dfe620a5ef2d32 Mon Sep 17 00:00:00 2001 From: orklah Date: Sat, 22 May 2021 16:36:12 +0200 Subject: [PATCH] Allow empty-string in first position of an type --- src/Psalm/Internal/Analyzer/CommentAnalyzer.php | 2 +- tests/AnnotationTest.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Internal/Analyzer/CommentAnalyzer.php b/src/Psalm/Internal/Analyzer/CommentAnalyzer.php index 34898c6a044..db29cfd6ea4 100644 --- a/src/Psalm/Internal/Analyzer/CommentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/CommentAnalyzer.php @@ -280,7 +280,7 @@ public static function splitDocLine(string $return_block): array $last_char = $i > 0 ? $return_block[$i - 1] : null; if ($quote_char) { - if ($char === $quote_char && $i > 1 && !$escaped) { + if ($char === $quote_char && !$escaped) { $quote_char = null; $type .= $char; diff --git a/tests/AnnotationTest.php b/tests/AnnotationTest.php index c4a3c43222e..5835fb94041 100644 --- a/tests/AnnotationTest.php +++ b/tests/AnnotationTest.php @@ -1201,6 +1201,15 @@ function takesFlags(int $flags) : void { takesFlags(FileFlag::MODIFIED | FileFlag::NEW);' ], + 'emptyStringFirst' => [ + '