diff --git a/src/Extension/EscaperExtension.php b/src/Extension/EscaperExtension.php index e09bfeb..7c2c61f 100644 --- a/src/Extension/EscaperExtension.php +++ b/src/Extension/EscaperExtension.php @@ -10,8 +10,7 @@ class EscaperExtension implements ExtensionInterface { - /** @var Escaper */ - private $escaper; + private Escaper $escaper; public function __construct(?string $encoding = null) { diff --git a/src/Extension/UrlExtension.php b/src/Extension/UrlExtension.php index aa88637..a4b3cbf 100644 --- a/src/Extension/UrlExtension.php +++ b/src/Extension/UrlExtension.php @@ -12,11 +12,9 @@ class UrlExtension implements ExtensionInterface { - /** @var ServerUrlHelper */ - private $serverUrlHelper; + private ServerUrlHelper $serverUrlHelper; - /** @var UrlHelper */ - private $urlHelper; + private UrlHelper $urlHelper; public function __construct(UrlHelper $urlHelper, ServerUrlHelper $serverUrlHelper) { diff --git a/src/PlatesRenderer.php b/src/PlatesRenderer.php index 46c7b35..bb13084 100644 --- a/src/PlatesRenderer.php +++ b/src/PlatesRenderer.php @@ -28,8 +28,7 @@ class PlatesRenderer implements TemplateRendererInterface { use ArrayParametersTrait; - /** @var Engine */ - private $template; + private Engine $template; public function __construct(?Engine $template = null) { diff --git a/test/ConfigProviderTest.php b/test/ConfigProviderTest.php index 4514895..e11bbbd 100644 --- a/test/ConfigProviderTest.php +++ b/test/ConfigProviderTest.php @@ -9,8 +9,7 @@ class ConfigProviderTest extends TestCase { - /** @var ConfigProvider */ - private $provider; + private ConfigProvider $provider; protected function setUp(): void { diff --git a/test/Extension/EscaperExtensionTest.php b/test/Extension/EscaperExtensionTest.php index 4f9d149..98f200f 100644 --- a/test/Extension/EscaperExtensionTest.php +++ b/test/Extension/EscaperExtensionTest.php @@ -23,25 +23,30 @@ public function testRegistersEscaperFunctionsWithEngine(): void $engine = $this->prophesize(Engine::class); $engine - ->registerFunction('escapeHtml', Argument::that(function ($argument) { - return is_array($argument) && $argument[0] instanceof Escaper && $argument[1] === 'escapeHtml'; - }))->shouldBeCalled(); + ->registerFunction('escapeHtml', Argument::that( + static fn($argument) => is_array($argument) && + $argument[0] instanceof Escaper && $argument[1] === 'escapeHtml' + ))->shouldBeCalled(); $engine - ->registerFunction('escapeHtmlAttr', Argument::that(function ($argument) { - return is_array($argument) && $argument[0] instanceof Escaper && $argument[1] === 'escapeHtmlAttr'; - }))->shouldBeCalled(); + ->registerFunction('escapeHtmlAttr', Argument::that( + static fn($argument) => is_array($argument) && + $argument[0] instanceof Escaper && $argument[1] === 'escapeHtmlAttr' + ))->shouldBeCalled(); $engine - ->registerFunction('escapeJs', Argument::that(function ($argument) { - return is_array($argument) && $argument[0] instanceof Escaper && $argument[1] === 'escapeJs'; - }))->shouldBeCalled(); + ->registerFunction('escapeJs', Argument::that( + static fn($argument) => is_array($argument) && + $argument[0] instanceof Escaper && $argument[1] === 'escapeJs' + ))->shouldBeCalled(); $engine - ->registerFunction('escapeCss', Argument::that(function ($argument) { - return is_array($argument) && $argument[0] instanceof Escaper && $argument[1] === 'escapeCss'; - }))->shouldBeCalled(); + ->registerFunction('escapeCss', Argument::that( + static fn($argument) => is_array($argument) && + $argument[0] instanceof Escaper && $argument[1] === 'escapeCss' + ))->shouldBeCalled(); $engine - ->registerFunction('escapeUrl', Argument::that(function ($argument) { - return is_array($argument) && $argument[0] instanceof Escaper && $argument[1] === 'escapeUrl'; - }))->shouldBeCalled(); + ->registerFunction('escapeUrl', Argument::that( + static fn($argument) => is_array($argument) && + $argument[0] instanceof Escaper && $argument[1] === 'escapeUrl' + ))->shouldBeCalled(); $extension->register($engine->reveal()); } diff --git a/test/Extension/UrlExtensionTest.php b/test/Extension/UrlExtensionTest.php index 04d4a38..61dc2e9 100644 --- a/test/Extension/UrlExtensionTest.php +++ b/test/Extension/UrlExtensionTest.php @@ -23,8 +23,7 @@ class UrlExtensionTest extends TestCase /** @var ServerUrlHelper|ProphecyInterface */ private $serverUrlHelper; - /** @var UrlExtension */ - private $extension; + private UrlExtension $extension; public function setUp(): void { diff --git a/test/PlatesRendererFactoryTest.php b/test/PlatesRendererFactoryTest.php index 9eeee5a..1d1eccd 100644 --- a/test/PlatesRendererFactoryTest.php +++ b/test/PlatesRendererFactoryTest.php @@ -34,8 +34,7 @@ class PlatesRendererFactoryTest extends TestCase /** @var ContainerInterface|ProphecyInterface */ private $container; - /** @var bool */ - private $errorCaught = false; + private bool $errorCaught = false; public function setUp(): void { @@ -184,7 +183,7 @@ public function testExceptionIsRaisedIfMultiplePathsSpecifyDefaultNamespace(): v $factory = new PlatesRendererFactory(); // phpcs:ignore WebimpressCodingStandard.NamingConventions.ValidVariableName.NotCamelCaps - set_error_handler(function (int $_errno, string $_errstr) { + set_error_handler(function (int $_errno, string $_errstr): void { $this->errorCaught = true; }, E_USER_WARNING); $factory($this->container->reveal()); diff --git a/test/PlatesRendererTest.php b/test/PlatesRendererTest.php index 07d5ba2..fcbfe0d 100644 --- a/test/PlatesRendererTest.php +++ b/test/PlatesRendererTest.php @@ -28,11 +28,9 @@ class PlatesRendererTest extends TestCase { use ProphecyTrait; - /** @var Engine */ - private $platesEngine; + private Engine $platesEngine; - /** @var bool */ - private $error; + private bool $error; public function setUp(): void { @@ -121,7 +119,7 @@ public function testAddingSecondPathWithoutNamespaceIsANoopAndRaisesWarning($ren $path = array_shift($paths); // phpcs:ignore WebimpressCodingStandard.NamingConventions.ValidVariableName.NotCamelCaps - set_error_handler(function (int $_errno, string $message) { + set_error_handler(function (int $_errno, string $message): bool { $this->error = true; $this->assertStringContainsString('duplicate', $message); return true; @@ -250,7 +248,7 @@ public function testAddParameterToOneTemplate(): void $this->assertEquals($content, $result); // phpcs:ignore WebimpressCodingStandard.NamingConventions.ValidVariableName.NotCamelCaps - set_error_handler(function (int $_errno, string $message) { + set_error_handler(function (int $_errno, string $message): bool { $this->assertStringContainsString('Undefined variable: name', $message); return true; }, E_NOTICE);