From f3b8cd0d6d745864720adf5c6b246b853202025d Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 23 Nov 2023 12:20:04 +0100 Subject: [PATCH] Fix PHPStan issue: Parameter #1 $kernel of class Symfony\Bundle\FrameworkBundle\Console\Application constructor expects Symfony\Component\HttpKernel\KernelInterface, Symfony\Component\HttpKernel\KernelInterface|null given --- tests/Command/AbstractCommandTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/Command/AbstractCommandTest.php b/tests/Command/AbstractCommandTest.php index 62862cec91..34dce7cddb 100644 --- a/tests/Command/AbstractCommandTest.php +++ b/tests/Command/AbstractCommandTest.php @@ -15,6 +15,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Tester\CommandTester; +use Symfony\Component\HttpKernel\KernelInterface; abstract class AbstractCommandTest extends KernelTestCase { @@ -33,7 +34,9 @@ protected function executeCommand(array $arguments, array $inputs = []): Command // this uses a special testing container that allows you to fetch private services /** @var Command $command */ $command = static::getContainer()->get($this->getCommandFqcn()); - $command->setApplication(new Application(self::$kernel)); + /** @var KernelInterface $kernel */ + $kernel = self::$kernel; + $command->setApplication(new Application($kernel)); $commandTester = new CommandTester($command); $commandTester->setInputs($inputs);