From 62fb15490636d6391f71957c90fb85a9922d18dc Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 23 Feb 2019 00:19:33 +0100 Subject: [PATCH] make OutputFormatters specific for DumpRectorsCommand --- bin/container.php | 4 +++- .../src/Command/DumpRectorsCommand.php | 14 +++++++------- .../DumpRectorsOutputFormatterInterface.php} | 4 ++-- .../JsonDumpRectorsOutputFormatter.php} | 6 +++--- .../MarkdownDumpRectorsOutputFormatter.php} | 6 +++--- 5 files changed, 18 insertions(+), 16 deletions(-) rename packages/ContributorTools/src/Contract/{OutputFormatterInterface.php => OutputFormatter/DumpRectorsOutputFormatterInterface.php} (74%) rename packages/ContributorTools/src/OutputFormatter/{JsonOutputFormatter.php => DumpRectors/JsonDumpRectorsOutputFormatter.php} (93%) rename packages/ContributorTools/src/OutputFormatter/{MarkdownOutputFormatter.php => DumpRectors/MarkdownDumpRectorsOutputFormatter.php} (95%) diff --git a/bin/container.php b/bin/container.php index e065156afb1..1b3788f2c9c 100644 --- a/bin/container.php +++ b/bin/container.php @@ -20,7 +20,9 @@ $configFiles = array_filter($configFiles); // 3. Build DI container -$rectorKernel = new RectorKernel('prod', InputDetector::isDebug()); +// to override the configs without clearing cache +$environment = 'prod' . random_int(1, 10000000); +$rectorKernel = new RectorKernel($environment, InputDetector::isDebug()); if ($configFiles) { $rectorKernel->setConfigs($configFiles); } diff --git a/packages/ContributorTools/src/Command/DumpRectorsCommand.php b/packages/ContributorTools/src/Command/DumpRectorsCommand.php index d8a2511e24e..04768e81ece 100644 --- a/packages/ContributorTools/src/Command/DumpRectorsCommand.php +++ b/packages/ContributorTools/src/Command/DumpRectorsCommand.php @@ -4,7 +4,7 @@ namespace Rector\ContributorTools\Command; use Rector\Console\Command\AbstractCommand; use Rector\Console\Shell; -use Rector\ContributorTools\Contract\OutputFormatterInterface; +use Rector\ContributorTools\Contract\OutputFormatter\DumpRectorsOutputFormatterInterface; use Rector\ContributorTools\Finder\RectorsFinder; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -19,19 +19,19 @@ final class DumpRectorsCommand extends AbstractCommand private $rectorsFinder; /** - * @var OutputFormatterInterface[] + * @var DumpRectorsOutputFormatterInterface[] */ - private $outputFormatters = []; + private $dumpRectorsOutputFormatterInterfaces = []; /** - * @param OutputFormatterInterface[] $outputFormatters + * @param DumpRectorsOutputFormatterInterface[] $dumpRectorsOutputFormatterInterfaces */ - public function __construct(RectorsFinder $rectorsFinder, array $outputFormatters) + public function __construct(RectorsFinder $rectorsFinder, array $dumpRectorsOutputFormatterInterfaces) { parent::__construct(); $this->rectorsFinder = $rectorsFinder; - $this->outputFormatters = $outputFormatters; + $this->dumpRectorsOutputFormatterInterfaces = $dumpRectorsOutputFormatterInterfaces; } protected function configure(): void @@ -52,7 +52,7 @@ final class DumpRectorsCommand extends AbstractCommand $packageRectors = $this->rectorsFinder->findInDirectory(__DIR__ . '/../../../../packages'); $generalRectors = $this->rectorsFinder->findInDirectory(__DIR__ . '/../../../../src'); - foreach ($this->outputFormatters as $outputFormatter) { + foreach ($this->dumpRectorsOutputFormatterInterfaces as $outputFormatter) { if ($outputFormatter->getName() !== $input->getOption('output-format')) { continue; } diff --git a/packages/ContributorTools/src/Contract/OutputFormatterInterface.php b/packages/ContributorTools/src/Contract/OutputFormatter/DumpRectorsOutputFormatterInterface.php similarity index 74% rename from packages/ContributorTools/src/Contract/OutputFormatterInterface.php rename to packages/ContributorTools/src/Contract/OutputFormatter/DumpRectorsOutputFormatterInterface.php index 90cdb21bb57..f7d7c131739 100644 --- a/packages/ContributorTools/src/Contract/OutputFormatterInterface.php +++ b/packages/ContributorTools/src/Contract/OutputFormatter/DumpRectorsOutputFormatterInterface.php @@ -1,10 +1,10 @@