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

Fix #3270 - support multiple spaces before @param

This commit is contained in:
Brown 2020-05-02 19:39:10 -04:00
parent 29741cd76d
commit 2ce65e1d03
2 changed files with 9 additions and 2 deletions

View File

@ -203,7 +203,7 @@ class DocComment
$last = false;
foreach ($lines as $k => $line) {
if (preg_match('/^[ \t]*\*?\s?@\w/i', $line)) {
if (preg_match('/^[ \t]*\*?\s*@\w/i', $line)) {
$last = $k;
} elseif (preg_match('/^\s*\r?$/', $line)) {
$last = false;
@ -222,7 +222,7 @@ class DocComment
$line = str_replace("\r", '', $line);
if (preg_match('/^[ \t]*\*?\s?@([\w\-:]+)[\t ]*(.*)$/sm', $line, $matches, PREG_OFFSET_CAPTURE)) {
if (preg_match('/^[ \t]*\*?\s*@([\w\-:]+)[\t ]*(.*)$/sm', $line, $matches, PREG_OFFSET_CAPTURE)) {
/** @var array<int, array{string, int}> $matches */
list($full_match_info, $type_info, $data_info) = $matches;

View File

@ -1136,6 +1136,13 @@ class AnnotationTest extends TestCase
'$arr' => 'array{\'foo\\\\bar\nbaz\': string}'
]
],
'doubleSpaceBeforeAt' => [
'<?php
/**
* @param string $c
*/
function foo($c) : void {}'
],
];
}