mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Fix #953 - support spaces either side of |
This commit is contained in:
parent
ebc65baa91
commit
867ebd4441
@ -735,11 +735,23 @@ class CommentChecker
|
||||
) {
|
||||
throw new DocblockParseException('Invalid string ' . $return_block);
|
||||
}
|
||||
} elseif ($char === ' ' || $char === "\t") {
|
||||
} elseif ($char === ' ') {
|
||||
if ($brackets) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($next_char === '|') {
|
||||
++$i;
|
||||
$type .= $next_char;
|
||||
continue;
|
||||
}
|
||||
|
||||
$last_char = $i > 0 ? $return_block[$i - 1] : null;
|
||||
|
||||
if ($last_char === '|') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($next_char === ':') {
|
||||
++$i;
|
||||
$type .= ':';
|
||||
|
@ -960,6 +960,13 @@ class AnnotationTest extends TestCase
|
||||
|
||||
$a1->bar();',
|
||||
],
|
||||
'spaceInType' => [
|
||||
'<?php
|
||||
/** @return string | null */
|
||||
function foo(string $s = null) {
|
||||
return $s;
|
||||
}',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user