findDecorativeComments($path, $relative)); } return $errors; } /** @return list */ private function findDecorativeComments(string $path, string $relative): array { $errors = []; foreach (file($path) as $idx => $raw) { $stripped = ltrim($raw); if (!str_starts_with($stripped, '//')) { continue; } if (str_starts_with($stripped, '///') || str_starts_with($stripped, '//!')) { continue; } if (!preg_match(self::DECORATIVE_RUN_RE, $stripped)) { continue; } $errors[] = "{$relative}:" . ($idx + 1) . ': decorative section comment'; } return $errors; } }