note('This command only considers templates that are using the *.fluid.* file extension.'); $errors = $deprecations = 0; $results = $this->cacheWarmupService->warmupTemplatesInAllPackages(); $templatesCount = count($results); foreach ($results as $result) { $templateFile = $result->path; if (str_starts_with($templateFile, Environment::getProjectPath())) { $templateFile = substr($templateFile, strlen(Environment::getProjectPath()) + 1); } foreach ($result->errors as $error) { $errors++; $output->writeln($formatter->formatSection( 'ERROR', $templateFile . ': ' . $error->getMessage(), 'error', )); } foreach ($result->deprecations as $deprecation) { $deprecations++; $output->writeln($formatter->formatSection( 'DEPRECATION', $templateFile . ': ' . $deprecation->message, 'info', )); } } if ($output->isVerbose()) { if ($errors > 0) { $output->writeln(''); $io->error(sprintf('%d error(s) found in %d warmed up templates.', $errors, $templatesCount)); } if ($deprecations > 0) { $output->writeln(''); $io->warning(sprintf('%d deprecation(s) found in %d warmed up templates.', $deprecations, $templatesCount)); } if ($errors === 0 && $deprecations === 0) { $io->success(sprintf('%d templates warmed up without errors or deprecations.', $templatesCount)); } } return $errors > 0 ? Command::FAILURE : Command::SUCCESS; } }