diff --git a/libs/php-utils/src/PhpDoc.php b/libs/php-utils/src/PhpDoc.php index 039955e..760d31c 100644 --- a/libs/php-utils/src/PhpDoc.php +++ b/libs/php-utils/src/PhpDoc.php @@ -39,13 +39,9 @@ public static function getTags(string $comment, array $options = []): array 'default' => 'description', // default tag name, first line text will attach to it. ], $options); - $allow = (array)$options['allow']; + $allow = (array)$options['allow']; $ignored = (array)$options['ignore']; - - // always allow default tag - if ($default = (string)$options['default']) { - $allow[] = $default; - } + $default = (string)$options['default']; $comment = \str_replace("\r\n", "\n", $comment); $comment = "@{$default} \n" . @@ -59,11 +55,12 @@ public static function getTags(string $comment, array $options = []): array foreach ($parts as $part) { if (\preg_match('/^(\w+)(.*)/ms', \trim($part), $matches)) { $name = $matches[1]; - if (\in_array($name, $ignored, true)) { + if (!$name || \in_array($name, $ignored, true)) { continue; } - if ($allow && !\in_array($name, $allow, true)) { + // always allow default tag + if ($default !== $name && $allow && !\in_array($name, $allow, true)) { continue; }