Skip to content

Commit

Permalink
Revert "Do not boot the kernel when using composer command"
Browse files Browse the repository at this point in the history
This reverts commit b5a2093.

We need to boot the kernel, because one could create a custom composer
task.
  • Loading branch information
lyrixx committed Nov 13, 2024
1 parent 8736914 commit 3a18182
Showing 1 changed file with 1 addition and 25 deletions.
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

0 comments on commit 3a18182

Please sign in to comment.