Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Do not boot the kernel when using composer command" #564

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 1 addition & 25 deletions src/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

namespace Castor\Console;

use Castor\Console\Command\ComposerCommand;
use Castor\Container;
use Castor\Kernel;
use Symfony\Component\Console\Application as SymfonyApplication;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\CommandNotFoundException;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down Expand Up @@ -45,9 +43,7 @@ public function doRun(InputInterface $input, OutputInterface $output): int
// @phpstan-ignore-next-line
Container::set($this->containerBuilder->get(Container::class));

if ($this->shouldBootKernel($input)) {
$this->kernel->boot($input, $output);
}
$this->kernel->boot($input, $output);

return parent::doRun($input, $output);
}
Expand Down Expand Up @@ -89,26 +85,6 @@ protected function getDefaultInputDefinition(): InputDefinition
return $definition;
}

private function shouldBootKernel(InputInterface $input): bool
{
$name = $input->getFirstArgument();
if (!$name) {
return true;
}

try {
$command = $this->find($name);
} catch (CommandNotFoundException) {
return true;
}

if ($command instanceof ComposerCommand) {
return false;
}

return true;
}

private function getLogo(): string
{
if (!($_SERVER['CASTOR_TEST'] ?? false)) {
Expand Down