Skip to content

Commit 115a071

Browse files
committed
fix parse method comments as flag rules
1 parent 3e19677 commit 115a071

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Diff for: src/Annotate/DocblockRules.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ protected function parseMultiLines(array $lines): array
145145
continue;
146146
}
147147

148-
$nodes = Str::explode($trimmed, ' ', 2);
148+
$nodes = Str::explode($trimmed, ' ', 2);
149149
if (!isset($nodes[1])) {
150150
if ($index === 0) { // invalid first line
151151
continue;
@@ -156,14 +156,18 @@ protected function parseMultiLines(array $lines): array
156156
continue;
157157
}
158158

159-
$name = $nodes[0];
159+
$name = trim($nodes[0], '.');
160160
if (!preg_match('/^[\w ,-]{0,48}$/', $name)) {
161+
if ($index === 0) { // invalid first line
162+
continue;
163+
}
164+
161165
// multi desc message.
162166
$rules[$index - 1][1] .= "\n" . $trimmed;
163167
continue;
164168
}
165169

166-
$rules[$index] = $nodes;
170+
$rules[$index] = [$name, $nodes[1]];
167171
$index++;
168172
}
169173

0 commit comments

Comments
 (0)