info('šŸ› ļø Starting Atom Code Fixer...'); // 1. Check if Laravel Pint is installed (Standard in Laravel 9+) if (! file_exists(base_path('vendor/bin/pint'))) { $this->warn('āš ļø Laravel Pint not found. Installing...'); $this->runProcess(['composer', 'require', 'laravel/pint', '--dev']); } // 2. Run Pint (Fixes styling, unused imports, spacing) $this->info('šŸŽØ Running Code Style Fixer (Pint)...'); $params = ['vendor/bin/pint']; if ($this->option('dirty')) { $params[] = '--dirty'; } $process = new Process($params, base_path()); $process->setTimeout(300); $process->run(function ($type, $buffer) { $this->output->write($buffer); }); if (! $process->isSuccessful()) { $this->error('āŒ Pint encountered some issues.'); } else { $this->info('āœ… Code style fixed!'); } // 3. Optional: Run PHPStan/Larastan if available (For deep logic checks) if (file_exists(base_path('vendor/bin/phpstan'))) { $this->info("\n🧠 Running Static Analysis (PHPStan)..."); $analyze = new Process(['vendor/bin/phpstan', 'analyse', 'app'], base_path()); $analyze->setTimeout(300); $analyze->run(function ($type, $buffer) { $this->output->write($buffer); }); } $this->newLine(); $this->info('šŸš€ Code cleanup finished.'); return 0; } /** * @param array $command */ private function runProcess(array $command): void { $process = new Process($command, base_path()); $process->run(function ($type, $buffer) { $this->output->write($buffer); }); } }