From 8454519822026a3b073dd6a1e69a7472076aecfe Mon Sep 17 00:00:00 2001 From: David Grudl Date: Fri, 15 Dec 2023 00:38:52 +0100 Subject: [PATCH] readonly properties --- src/Application/ErrorPresenter.php | 2 +- src/Application/LinkGenerator.php | 6 +++--- src/Application/MicroPresenter.php | 6 +++--- src/Bridges/ApplicationDI/ApplicationExtension.php | 8 ++++---- src/Bridges/ApplicationDI/LatteExtension.php | 4 ++-- src/Bridges/ApplicationDI/PresenterFactoryCallback.php | 6 +++--- src/Bridges/ApplicationDI/RoutingExtension.php | 2 +- src/Bridges/ApplicationLatte/TemplateFactory.php | 8 ++++---- src/Bridges/ApplicationLatte/UIExtension.php | 2 +- src/Bridges/ApplicationTracy/RoutingPanel.php | 6 +++--- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/Application/ErrorPresenter.php b/src/Application/ErrorPresenter.php index 4e88c646e..cda2efcf5 100644 --- a/src/Application/ErrorPresenter.php +++ b/src/Application/ErrorPresenter.php @@ -20,7 +20,7 @@ final class ErrorPresenter implements Application\IPresenter { public function __construct( - private ?ILogger $logger = null, + private readonly ?ILogger $logger = null, ) { } diff --git a/src/Application/LinkGenerator.php b/src/Application/LinkGenerator.php index 68b084b04..c31b19161 100644 --- a/src/Application/LinkGenerator.php +++ b/src/Application/LinkGenerator.php @@ -19,9 +19,9 @@ final class LinkGenerator { public function __construct( - private Router $router, - private UrlScript $refUrl, - private ?IPresenterFactory $presenterFactory = null, + private readonly Router $router, + private readonly UrlScript $refUrl, + private readonly ?IPresenterFactory $presenterFactory = null, ) { } diff --git a/src/Application/MicroPresenter.php b/src/Application/MicroPresenter.php index 94ebde85c..fcab61954 100644 --- a/src/Application/MicroPresenter.php +++ b/src/Application/MicroPresenter.php @@ -26,9 +26,9 @@ final class MicroPresenter implements Application\IPresenter public function __construct( - private ?Nette\DI\Container $context = null, - private ?Nette\Http\IRequest $httpRequest = null, - private ?Router $router = null, + private readonly ?Nette\DI\Container $context = null, + private readonly ?Nette\Http\IRequest $httpRequest = null, + private readonly ?Router $router = null, ) { } diff --git a/src/Bridges/ApplicationDI/ApplicationExtension.php b/src/Bridges/ApplicationDI/ApplicationExtension.php index e1b7f6520..95cede590 100644 --- a/src/Bridges/ApplicationDI/ApplicationExtension.php +++ b/src/Bridges/ApplicationDI/ApplicationExtension.php @@ -22,15 +22,15 @@ */ final class ApplicationExtension extends Nette\DI\CompilerExtension { - private array $scanDirs; + private readonly array $scanDirs; private int $invalidLinkMode; public function __construct( - private bool $debugMode = false, + private readonly bool $debugMode = false, ?array $scanDirs = null, - private ?string $tempDir = null, - private ?Nette\Loaders\RobotLoader $robotLoader = null, + private readonly ?string $tempDir = null, + private readonly ?Nette\Loaders\RobotLoader $robotLoader = null, ) { $this->scanDirs = (array) $scanDirs; } diff --git a/src/Bridges/ApplicationDI/LatteExtension.php b/src/Bridges/ApplicationDI/LatteExtension.php index 596938a2c..6fffe737a 100644 --- a/src/Bridges/ApplicationDI/LatteExtension.php +++ b/src/Bridges/ApplicationDI/LatteExtension.php @@ -22,8 +22,8 @@ final class LatteExtension extends Nette\DI\CompilerExtension { public function __construct( - private string $tempDir, - private bool $debugMode = false, + private readonly string $tempDir, + private readonly bool $debugMode = false, ) { } diff --git a/src/Bridges/ApplicationDI/PresenterFactoryCallback.php b/src/Bridges/ApplicationDI/PresenterFactoryCallback.php index 07347de5f..06449b7e6 100644 --- a/src/Bridges/ApplicationDI/PresenterFactoryCallback.php +++ b/src/Bridges/ApplicationDI/PresenterFactoryCallback.php @@ -19,9 +19,9 @@ final class PresenterFactoryCallback { public function __construct( - private Nette\DI\Container $container, - private int $invalidLinkMode, - private ?string $touchToRefresh, + private readonly Nette\DI\Container $container, + private readonly int $invalidLinkMode, + private readonly ?string $touchToRefresh, ) { } diff --git a/src/Bridges/ApplicationDI/RoutingExtension.php b/src/Bridges/ApplicationDI/RoutingExtension.php index e9e4ed4d7..3166cb2aa 100644 --- a/src/Bridges/ApplicationDI/RoutingExtension.php +++ b/src/Bridges/ApplicationDI/RoutingExtension.php @@ -21,7 +21,7 @@ final class RoutingExtension extends Nette\DI\CompilerExtension { public function __construct( - private bool $debugMode = false, + private readonly bool $debugMode = false, ) { } diff --git a/src/Bridges/ApplicationLatte/TemplateFactory.php b/src/Bridges/ApplicationLatte/TemplateFactory.php index 9f7f82392..f00e7fb00 100644 --- a/src/Bridges/ApplicationLatte/TemplateFactory.php +++ b/src/Bridges/ApplicationLatte/TemplateFactory.php @@ -25,10 +25,10 @@ class TemplateFactory implements UI\TemplateFactory public function __construct( - private LatteFactory $latteFactory, - private ?Nette\Http\IRequest $httpRequest = null, - private ?Nette\Security\User $user = null, - private ?Nette\Caching\Storage $cacheStorage = null, + private readonly LatteFactory $latteFactory, + private readonly ?Nette\Http\IRequest $httpRequest = null, + private readonly ?Nette\Security\User $user = null, + private readonly ?Nette\Caching\Storage $cacheStorage = null, $templateClass = null, ) { if ($templateClass && (!class_exists($templateClass) || !is_a($templateClass, Template::class, true))) { diff --git a/src/Bridges/ApplicationLatte/UIExtension.php b/src/Bridges/ApplicationLatte/UIExtension.php index 10f2a966e..2071a69fd 100644 --- a/src/Bridges/ApplicationLatte/UIExtension.php +++ b/src/Bridges/ApplicationLatte/UIExtension.php @@ -24,7 +24,7 @@ final class UIExtension extends Latte\Extension { public function __construct( - private ?UI\Control $control, + private readonly ?UI\Control $control, ) { } diff --git a/src/Bridges/ApplicationTracy/RoutingPanel.php b/src/Bridges/ApplicationTracy/RoutingPanel.php index 695fc99d4..fa0209b46 100644 --- a/src/Bridges/ApplicationTracy/RoutingPanel.php +++ b/src/Bridges/ApplicationTracy/RoutingPanel.php @@ -25,9 +25,9 @@ final class RoutingPanel implements Tracy\IBarPanel public function __construct( - private Routing\Router $router, - private Nette\Http\IRequest $httpRequest, - private Nette\Application\IPresenterFactory $presenterFactory, + private readonly Routing\Router $router, + private readonly Nette\Http\IRequest $httpRequest, + private readonly Nette\Application\IPresenterFactory $presenterFactory, ) { }