1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 12:55:26 +01:00

Fix return type space issue

This commit is contained in:
Matthew Brown 2017-09-16 15:08:11 -04:00
parent 7c261d7d1f
commit e84586cfaa

View File

@ -520,16 +520,18 @@ class CommentChecker
/** @var int */ /** @var int */
$special_type_width = max($special_type_lengths) + 1; $special_type_width = max($special_type_lengths) + 1;
$special_types = count($parsed_doc_comment['specials']); $last_type = null;
foreach ($parsed_doc_comment['specials'] as $type => $lines) { foreach ($parsed_doc_comment['specials'] as $type => $lines) {
if ($last_type !== null && ($last_type !== 'return' || $type !== 'psalm-return')) {
$doc_comment_text .= $left_padding . ' *' . PHP_EOL;
}
foreach ($lines as $line) { foreach ($lines as $line) {
$doc_comment_text .= $left_padding . ' * @' . str_pad($type, $special_type_width) . $line . PHP_EOL; $doc_comment_text .= $left_padding . ' * @' . str_pad($type, $special_type_width) . $line . PHP_EOL;
} }
if ($special_types-- > 1) { $last_type = $type;
$doc_comment_text .= $left_padding . ' *'. PHP_EOL;
}
} }
} }