diff --git a/src/Pug/PugSymfonyEngine.php b/src/Pug/PugSymfonyEngine.php index 421e211..d174439 100644 --- a/src/Pug/PugSymfonyEngine.php +++ b/src/Pug/PugSymfonyEngine.php @@ -256,7 +256,7 @@ public function exists($name): bool public function supports($name): bool { foreach ($this->getOptionDefault('extensions', ['.pug', '.jade']) as $extension) { - if (str_ends_with($name, $extension)) { + if ($extension && str_ends_with($name, $extension)) { return true; } } diff --git a/src/Pug/Symfony/Traits/HelpersHandler.php b/src/Pug/Symfony/Traits/HelpersHandler.php index e2e3764..33e3d36 100644 --- a/src/Pug/Symfony/Traits/HelpersHandler.php +++ b/src/Pug/Symfony/Traits/HelpersHandler.php @@ -352,9 +352,10 @@ protected function getHttpFoundationExtension(): HttpFoundationExtension $stack = $this->stack ?? $this->container->get('request_stack'); /* @var RequestContext $context */ - $context = $this->context ?? ($this->container->has('router.request_context') - ? $this->container->get('router.request_context') - : $this->container->get('router')->getContext() + $context = $this->context ?? ( + $this->container->has('router.request_context') + ? $this->container->get('router.request_context') + : $this->container->get('router')->getContext() ); return new HttpFoundationExtension(new UrlHelper($stack, $context)); diff --git a/tests/Pug/PugSymfonyEngineTest.php b/tests/Pug/PugSymfonyEngineTest.php index 3ed99b9..97a4b92 100644 --- a/tests/Pug/PugSymfonyEngineTest.php +++ b/tests/Pug/PugSymfonyEngineTest.php @@ -115,7 +115,7 @@ public function testRequireTwig() self::expectException(RuntimeException::class); self::expectExceptionMessage('Twig needs to be configured.'); - $object = new class () { + $object = new class() { use HelpersHandler; public function wrongEnhance(): void @@ -382,7 +382,7 @@ public function testAssetHelperPhp() '/