Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6ea8ab1

Browse files
committed
fix: parse comments tags error
1 parent 8b222eb commit 6ea8ab1

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

‎libs/php-utils/src/PhpDoc.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,9 @@ public static function getTags(string $comment, array $options = []): array
3939
'default' => 'description', // default tag name, first line text will attach to it.
4040
], $options);
4141

42-
$allow = (array)$options['allow'];
42+
$allow = (array)$options['allow'];
4343
$ignored = (array)$options['ignore'];
44-
45-
// always allow default tag
46-
if ($default = (string)$options['default']) {
47-
$allow[] = $default;
48-
}
44+
$default = (string)$options['default'];
4945

5046
$comment = \str_replace("\r\n", "\n", $comment);
5147
$comment = "@{$default}\n" .
@@ -59,11 +55,12 @@ public static function getTags(string $comment, array $options = []): array
5955
foreach ($parts as $part) {
6056
if (\preg_match('/^(\w+)(.*)/ms', \trim($part), $matches)) {
6157
$name = $matches[1];
62-
if (\in_array($name, $ignored, true)) {
58+
if (!$name || \in_array($name, $ignored, true)) {
6359
continue;
6460
}
6561

66-
if ($allow && !\in_array($name, $allow, true)) {
62+
// always allow default tag
63+
if ($default !== $name && $allow && !\in_array($name, $allow, true)) {
6764
continue;
6865
}
6966

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /