From 277bddc32deefa4b367b95fa8c72c68319b51ba5 Mon Sep 17 00:00:00 2001 From: FabianSchmick Date: Mon, 14 Oct 2024 11:17:11 +0000 Subject: [PATCH] Fix CS with PHP-CS-Fixer --- src/Handler/EmbeddedShortcodeHandler.php | 7 ++++--- tests/Functional/EmbeddedShortcodeHandlerTest.php | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Handler/EmbeddedShortcodeHandler.php b/src/Handler/EmbeddedShortcodeHandler.php index cfb6b97..56179fc 100644 --- a/src/Handler/EmbeddedShortcodeHandler.php +++ b/src/Handler/EmbeddedShortcodeHandler.php @@ -2,6 +2,7 @@ namespace Webfactory\ShortcodeBundle\Handler; +use InvalidArgumentException; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; use Symfony\Component\HttpFoundation\RequestStack; @@ -38,11 +39,11 @@ public function __construct( string $controllerName, string $renderer, RequestStack $requestStack, - LoggerInterface $logger = null + ?LoggerInterface $logger = null ) { $callableFragments = explode('::', $controllerName); - if (!is_array($callableFragments) || !isset($callableFragments[1]) || !method_exists($callableFragments[0], $callableFragments[1])) { - throw new \InvalidArgumentException('The controller method: "'.$controllerName.'" does not exist.'); + if (!\is_array($callableFragments) || !isset($callableFragments[1]) || !method_exists($callableFragments[0], $callableFragments[1])) { + throw new InvalidArgumentException('The controller method: "'.$controllerName.'" does not exist.'); } $this->fragmentHandler = $fragmentHandler; diff --git a/tests/Functional/EmbeddedShortcodeHandlerTest.php b/tests/Functional/EmbeddedShortcodeHandlerTest.php index c727559..fe1d480 100644 --- a/tests/Functional/EmbeddedShortcodeHandlerTest.php +++ b/tests/Functional/EmbeddedShortcodeHandlerTest.php @@ -3,6 +3,7 @@ namespace Webfactory\ShortcodeBundle\Tests\Functional; use Generator; +use InvalidArgumentException; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; @@ -89,7 +90,7 @@ public function validate_valid_controller_names(): void */ public function validate_invalid_controller_names(string $controllerName): void { - $this->expectException(\InvalidArgumentException::class); + $this->expectException(InvalidArgumentException::class); new EmbeddedShortcodeHandler($this->createMock(FragmentHandler::class), $controllerName, 'inline', $this->createMock(RequestStack::class)); } @@ -102,7 +103,7 @@ public function provideControllerNames(): Generator yield 'Not existing method' => [GuideController::class.'_notExistingMethod']; } - private function processShortcodes(string $content, Request $request = null): string + private function processShortcodes(string $content, ?Request $request = null): string { self::bootKernel();