diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 6582b45..e69de29 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,6 +0,0 @@ -parameters: - ignoreErrors: - - - message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#" - count: 1 - path: src/DependencyInjection/Configuration.php diff --git a/src/Test/WebTestCase.php b/src/Test/WebTestCase.php index 9681bd4..9ebc0fa 100644 --- a/src/Test/WebTestCase.php +++ b/src/Test/WebTestCase.php @@ -150,23 +150,31 @@ protected static function ajax(string $method, string $uri, array $params = [], /** * Execute a command and return output. * - * @param string $name Command name (e.g. "app:send") - * @param Command $command Command instance (e.g. new SendCommand()) - * @param array $arguments Possible command arguments and options - * @param array $otherCommands Possible other commands to define - * @param ?array $inputs Possible inputs to set inside command + * @param string $name Command name (e.g. "app:send") + * @param callable|object $command Command instance (e.g. new SendCommand()) + * @param array $arguments Possible command arguments and options + * @param array $otherCommands Possible other commands to define + * @param ?array $inputs Possible inputs to set inside command */ protected static function commandTest( string $name, - Command $command, + callable|object $command, array $arguments = [], array $otherCommands = [], ?array $inputs = null, ): string { $application = new Application(self::$client->getKernel()); - $application->add($command); - foreach ($otherCommands as $otherCommand) { - $application->add($otherCommand); + // @phpstan-ignore-next-line function.alreadyNarrowedType + if (\method_exists($application, 'addCommand')) { + $application->addCommand($command); + foreach ($otherCommands as $otherCommand) { + $application->addCommand($otherCommand); + } + } else { + $application->add($command); + foreach ($otherCommands as $otherCommand) { + $application->add($otherCommand); + } } $cmd = $application->find($name); $commandTester = new CommandTester($cmd);