1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Fix multiline docblock issue reporting issue

This commit is contained in:
Matthew Brown 2017-01-27 22:24:25 -07:00
parent 6714e28f5d
commit c868781731
2 changed files with 16 additions and 4 deletions

View File

@ -108,7 +108,11 @@ class CommentChecker
&& $line_parts[0][0] !== '{'
) {
$info->return_type = $line_parts[0];
$info->return_type_line_number = array_keys($return_specials)[0];
$line_number = array_keys($return_specials)[0];
if ($line_number) {
$info->return_type_line_number = $line_number;
}
}
}
@ -243,7 +247,15 @@ class CommentChecker
} elseif (preg_match('/^\s*$/', $line)) {
$last = false;
} elseif ($last !== false) {
$lines[$last] = rtrim($lines[$last]) .' '. trim($line);
$old_last_line = $lines[$last];
$lines[$last] = rtrim($old_last_line) .' '. trim($line);
if ($line_number) {
$old_line_number = $line_map[$old_last_line];
unset($line_map[$old_last_line]);
$line_map[$lines[$last]] = $old_line_number;
}
unset($lines[$k]);
}

View File

@ -34,8 +34,8 @@ use Psalm\Type\Atomic\TNamedObject;
abstract class FunctionLikeChecker extends SourceChecker implements StatementsSource
{
const RETURN_TYPE_REGEX = '/\\:\s+(\\??[A-Za-z0-9_\\\\]+)/';
const PARAM_TYPE_REGEX = '/^(\\??[A-Za-z0-9_\\\\]+)\s/';
const RETURN_TYPE_REGEX = '/\\:\s+(\\??[A-Za-z0-9_\\\\\[\]]+)/';
const PARAM_TYPE_REGEX = '/^(\\??[A-Za-z0-9_\\\\\[\]]+)\s/';
/**
* @var Closure|Function_|ClassMethod