From f96cf5ddbbc9e011611fa5396bf87429e6e7a4fe Mon Sep 17 00:00:00 2001 From: tomkyle <412560+tomkyle@users.noreply.github.com> Date: Sun, 11 Aug 2024 19:15:27 +0200 Subject: [PATCH] Add instanceOf check --- src/SymfonyConsoleWrapper.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/SymfonyConsoleWrapper.php b/src/SymfonyConsoleWrapper.php index db1ee93..94772eb 100644 --- a/src/SymfonyConsoleWrapper.php +++ b/src/SymfonyConsoleWrapper.php @@ -17,16 +17,18 @@ public function __construct(protected TestRunnerInterface $testRunner) {} public function __invoke(InputInterface $input, OutputInterface $output): int { - - $config = $input->getOption('config'); - if ($config) { - $this->testRunner->setConfig($config); + if ($this->testRunner instanceof ConfigurableTestRunnerInterface) { + $config = $input->getOption('config'); + if ($config) { + $this->testRunner->setConfig($config); + } + + $colors = Process::isTtySupported(); + $this->testRunner->useColors($colors); } - $colors = Process::isTtySupported(); $file = $input->getArgument('file'); - - return ($this->testRunner->useColors($colors))($file); + return ($this->testRunner)($file); } }