1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00
This commit is contained in:
Daniil Gentili 2021-09-22 10:36:54 +02:00
parent 741c9ee471
commit 83d596e2e5
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -185,14 +185,17 @@ class FunctionLikeDocblockParser
foreach ($parsed_docblock->tags['psalm-if-this-is'] as $offset => $param) { foreach ($parsed_docblock->tags['psalm-if-this-is'] as $offset => $param) {
$line_parts = CommentAnalyzer::splitDocLine($param); $line_parts = CommentAnalyzer::splitDocLine($param);
if (count($line_parts) > 0) { $line_parts[0] = str_replace("\n", '', preg_replace('@^[ \t]*\*@m', '', $line_parts[0]));
$line_parts[0] = str_replace("\n", '', preg_replace('@^[ \t]*\*@m', '', $line_parts[0]));
$info->if_this_is = [ $info->if_this_is = [
'type' => str_replace("\n", '', $line_parts[0]), 'type' => str_replace("\n", '', $line_parts[0]),
'line_number' => $comment->getStartLine() + substr_count($comment_text, "\n", 0, $offset - $comment->getStartFilePos()), 'line_number' => $comment->getStartLine() + substr_count(
]; $comment->getText(),
} "\n",
0,
$offset - $comment->getStartFilePos()
),
];
} }
} }