filter(fn($f) => Str::endsWith($f, '.php')); foreach ($files as $file) { $content = @file_get_contents($file); if ($content && preg_match_all($pattern, $content, $matches)) { foreach ($matches[2] as $hook) { $hooks->push($hook); } } } } $hooks = $hooks->unique()->sort()->values(); if ($hooks->isEmpty()) { $this->info('未扫描到任何 hook'); } else { $this->info('All Supported Hooks:'); foreach ($hooks as $hook) { $this->line(' ' . $hook); } } } }