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

fix minor trim bug in original code and small speed up

This commit is contained in:
kkmuffme 2023-06-13 22:04:39 +02:00
parent e75d514ada
commit d4732f118e

View File

@ -87,7 +87,9 @@ class DocblockParser
if ($first_line_padding === null) {
$asterisk_pos = strpos($line, '*');
if ($asterisk_pos) {
if ($asterisk_pos === 0 || $asterisk_pos === 1) {
$first_line_padding = '';
} elseif ($asterisk_pos > 1) {
$first_line_padding = substr($line, 0, $asterisk_pos - 1);
}
}
@ -99,7 +101,7 @@ class DocblockParser
[$type] = $type_info;
[$data, $data_offset] = $data_info;
if (strpos($data, '*')) {
if (strpos($data, '*') !== false) {
$data = rtrim(preg_replace('/^ *\*\s*$/m', '', $data));
}