From 95750d8f08f5a64e76496e20ae147f5962ce070c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radim=20Vaculi=CC=81k?= Date: Sat, 4 May 2024 21:38:41 +0200 Subject: [PATCH] Added `readonly` --- src/Column/Action/Confirmation/StringConfirmation.php | 2 +- src/Components/DatagridPaginator/DatagridPaginator.php | 6 +++++- src/DataSource/ElasticsearchDataSource.php | 2 +- src/DataSource/SearchParamsBuilder.php | 2 +- src/Status/Option.php | 2 +- src/Utils/Sorting.php | 2 +- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Column/Action/Confirmation/StringConfirmation.php b/src/Column/Action/Confirmation/StringConfirmation.php index 9f702a2e..1cdd902b 100644 --- a/src/Column/Action/Confirmation/StringConfirmation.php +++ b/src/Column/Action/Confirmation/StringConfirmation.php @@ -5,7 +5,7 @@ final class StringConfirmation implements IConfirmation { - public function __construct(private string $question, private ?string $placeholderName = null) + public function __construct(private readonly string $question, private readonly ?string $placeholderName = null) { } diff --git a/src/Components/DatagridPaginator/DatagridPaginator.php b/src/Components/DatagridPaginator/DatagridPaginator.php index f0126510..9f4b57a4 100644 --- a/src/Components/DatagridPaginator/DatagridPaginator.php +++ b/src/Components/DatagridPaginator/DatagridPaginator.php @@ -26,7 +26,11 @@ class DatagridPaginator extends Control private ?string $templateFile = null; - public function __construct(private Translator $translator, private string $iconPrefix = 'fa fa-', private string $btnSecondaryClass = 'btn-default btn-secondary') + public function __construct( + private readonly Translator $translator, + private readonly string $iconPrefix = 'fa fa-', + private readonly string $btnSecondaryClass = 'btn-default btn-secondary' + ) { } diff --git a/src/DataSource/ElasticsearchDataSource.php b/src/DataSource/ElasticsearchDataSource.php index cd743523..38f65eb5 100644 --- a/src/DataSource/ElasticsearchDataSource.php +++ b/src/DataSource/ElasticsearchDataSource.php @@ -22,7 +22,7 @@ class ElasticsearchDataSource extends FilterableDataSource implements IDataSourc /** @var callable */ private $rowFactory; - public function __construct(private Client $client, string $indexName, ?callable $rowFactory = null) + public function __construct(private readonly Client $client, string $indexName, ?callable $rowFactory = null) { $this->searchParamsBuilder = new SearchParamsBuilder($indexName); diff --git a/src/DataSource/SearchParamsBuilder.php b/src/DataSource/SearchParamsBuilder.php index 8320c7b3..8c974585 100644 --- a/src/DataSource/SearchParamsBuilder.php +++ b/src/DataSource/SearchParamsBuilder.php @@ -21,7 +21,7 @@ final class SearchParamsBuilder private array $idsQueries = []; - public function __construct(private string $indexName) + public function __construct(private readonly string $indexName) { } diff --git a/src/Status/Option.php b/src/Status/Option.php index 24cb5f23..1733920a 100644 --- a/src/Status/Option.php +++ b/src/Status/Option.php @@ -27,7 +27,7 @@ class Option protected ?IConfirmation $confirmation = null; - public function __construct(private Datagrid $grid, protected ColumnStatus $columnStatus, protected mixed $value, protected string $text) + public function __construct(private readonly Datagrid $grid, protected ColumnStatus $columnStatus, protected mixed $value, protected string $text) { } diff --git a/src/Utils/Sorting.php b/src/Utils/Sorting.php index c7aaa642..9945f032 100644 --- a/src/Utils/Sorting.php +++ b/src/Utils/Sorting.php @@ -11,7 +11,7 @@ final class Sorting /** * @param mixed[]|string[] $sort */ - public function __construct(private array $sort, ?callable $sortCallback = null) + public function __construct(private readonly array $sort, ?callable $sortCallback = null) { $this->sortCallback = $sortCallback; }