refactor: console improvements — auto-discovery, centralized bootstrap, per-command help
- ConsoleApplication.discoverCommands() scans lib/Console/Commands/ automatically; adding a new command no longer requires editing bin/console - Command base class provides bootstrapApp(), bootstrapModuleApp(), requireBinScript() and projectRoot() helpers — eliminates fragile 4-level relative require_once paths - Per-command --help support via optional usage() method on Command - Docker-compose scheduler updated to use bin/console scheduler:run - Old bin scripts now emit deprecation hint to stderr when called directly Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -18,11 +18,9 @@ final class DoctorCommand extends Command
|
||||
|
||||
public function execute(array $args, array $options): int
|
||||
{
|
||||
// doctor.php is self-contained — include and let it run
|
||||
$scriptPath = __DIR__ . '/../../../bin/doctor.php';
|
||||
|
||||
// Capture the exit code by running as a subprocess to avoid
|
||||
// the script's own exit() call terminating our process.
|
||||
// doctor.php calls exit() internally — run as subprocess
|
||||
// to avoid terminating the console process.
|
||||
$scriptPath = $this->projectRoot() . '/bin/doctor.php';
|
||||
$command = PHP_BINARY . ' ' . escapeshellarg($scriptPath);
|
||||
passthru($command, $exitCode);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user