diff --git a/src/ServerUrlMiddleware.php b/src/ServerUrlMiddleware.php index bf85867..c3c100b 100644 --- a/src/ServerUrlMiddleware.php +++ b/src/ServerUrlMiddleware.php @@ -12,7 +12,7 @@ class ServerUrlMiddleware implements MiddlewareInterface { - public function __construct(private ServerUrlHelper $helper) + public function __construct(private readonly ServerUrlHelper $helper) { } diff --git a/src/UrlHelper.php b/src/UrlHelper.php index f79b465..326fb58 100644 --- a/src/UrlHelper.php +++ b/src/UrlHelper.php @@ -37,7 +37,7 @@ class UrlHelper implements UrlHelperInterface private ?ServerRequestInterface $request = null; - public function __construct(private RouterInterface $router) + public function __construct(private readonly RouterInterface $router) { } diff --git a/src/UrlHelperFactory.php b/src/UrlHelperFactory.php index da3ffb7..7fe2fa9 100644 --- a/src/UrlHelperFactory.php +++ b/src/UrlHelperFactory.php @@ -33,8 +33,8 @@ public static function __set_state(array $data): self * @param string $basePath Base path for the URL helper */ public function __construct( - private string $basePath = '/', - private string $routerServiceName = RouterInterface::class + private readonly string $basePath = '/', + private readonly string $routerServiceName = RouterInterface::class ) { } diff --git a/src/UrlHelperMiddleware.php b/src/UrlHelperMiddleware.php index 5b9f4bb..68d6db5 100644 --- a/src/UrlHelperMiddleware.php +++ b/src/UrlHelperMiddleware.php @@ -15,7 +15,7 @@ */ class UrlHelperMiddleware implements MiddlewareInterface { - public function __construct(private UrlHelperInterface $helper) + public function __construct(private readonly UrlHelperInterface $helper) { } diff --git a/src/UrlHelperMiddlewareFactory.php b/src/UrlHelperMiddlewareFactory.php index 7b64f5c..5cc3dad 100644 --- a/src/UrlHelperMiddlewareFactory.php +++ b/src/UrlHelperMiddlewareFactory.php @@ -26,7 +26,7 @@ public static function __set_state(array $data): self /** * Allow varying behavior based on URL helper service name. */ - public function __construct(private string $urlHelperServiceName = UrlHelper::class) + public function __construct(private readonly string $urlHelperServiceName = UrlHelper::class) { } diff --git a/test/RequestHandler.php b/test/RequestHandler.php index 6f2b68c..5336e0c 100644 --- a/test/RequestHandler.php +++ b/test/RequestHandler.php @@ -13,7 +13,7 @@ final class RequestHandler implements RequestHandlerInterface { private ?ServerRequestInterface $received = null; - private ResponseInterface $defaultResponse; + private readonly ResponseInterface $defaultResponse; public function __construct( ResponseInterface|null $defaultResponse = null,