Skip to content

Commit

Permalink
grab a service from the container only if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Jan 22, 2024
1 parent 24427e2 commit 23f67d6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Command/CachePoolClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$clearers = [];

$poolNames = $input->getArgument('pools');
if ($input->getOption('all')) {
if ($clearAll = $input->getOption('all')) {
if (!$this->poolNames) {
throw new InvalidArgumentException('Could not clear all cache pools, try specifying a specific pool or cache clearer.');
}
Expand All @@ -84,7 +84,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
foreach ($poolNames as $id) {
if ($this->poolClearer->hasPool($id)) {
$pools[$id] = $id;
} else {
} elseif (!$clearAll || $kernel->getContainer()->has($id)) {
$pool = $kernel->getContainer()->get($id);

if ($pool instanceof CacheItemPoolInterface) {
Expand Down

0 comments on commit 23f67d6

Please sign in to comment.