From e01df269c8102c2c3e3954851667790a9b3f3c61 Mon Sep 17 00:00:00 2001
From: Mathieu De Keyzer <me@theus.be>
Date: Tue, 2 Jan 2024 10:55:12 +0100
Subject: [PATCH] ref: yet another rector just before 6.0.0

---
 EMS/common-bundle/src/Entity/StoreData.php       |  2 +-
 .../src/Service/Pdf/PdfPrintOptions.php          | 16 ++++++++--------
 EMS/core-bundle/src/Entity/Channel.php           |  2 +-
 EMS/core-bundle/src/Entity/Dashboard.php         |  2 +-
 EMS/core-bundle/src/Entity/Form.php              |  2 +-
 EMS/core-bundle/src/Entity/FormVerification.php  |  8 ++++----
 EMS/core-bundle/src/Entity/QuerySearch.php       |  2 +-
 EMS/core-bundle/src/Entity/Task.php              |  6 ++----
 EMS/core-bundle/src/Entity/WysiwygStylesSet.php  |  2 +-
 .../pdo_mysql/Version20231210131505.php          |  4 ++--
 .../pdo_pgsql/Version20231210103056.php          |  4 ++--
 .../src/Entity/FormSubmission.php                | 12 ++++++------
 .../src/Entity/FormSubmissionFile.php            | 10 +++++-----
 13 files changed, 35 insertions(+), 37 deletions(-)

diff --git a/EMS/common-bundle/src/Entity/StoreData.php b/EMS/common-bundle/src/Entity/StoreData.php
index 2e886495b..648122695 100644
--- a/EMS/common-bundle/src/Entity/StoreData.php
+++ b/EMS/common-bundle/src/Entity/StoreData.php
@@ -12,7 +12,7 @@ class StoreData
 {
     use CreatedModifiedTrait;
 
-    private UuidInterface $id;
+    private readonly UuidInterface $id;
     private string $key;
     /** @var array<mixed> */
     protected array $data = [];
diff --git a/EMS/common-bundle/src/Service/Pdf/PdfPrintOptions.php b/EMS/common-bundle/src/Service/Pdf/PdfPrintOptions.php
index 02643f462..f82413e4f 100644
--- a/EMS/common-bundle/src/Service/Pdf/PdfPrintOptions.php
+++ b/EMS/common-bundle/src/Service/Pdf/PdfPrintOptions.php
@@ -15,14 +15,14 @@ class PdfPrintOptions
     private readonly string $size;
     private readonly ?string $chroot;
 
-    public const FILENAME = 'filename';
-    public const ATTACHMENT = 'attachment';
-    public const COMPRESS = 'compress';
-    public const HTML5_PARSING = 'html5Parsing';
-    public const PHP_ENABLED = 'phpEnabled';
-    public const ORIENTATION = 'orientation';
-    public const SIZE = 'size';
-    public const CHROOT = 'chroot';
+    final public const FILENAME = 'filename';
+    final public const ATTACHMENT = 'attachment';
+    final public const COMPRESS = 'compress';
+    final public const HTML5_PARSING = 'html5Parsing';
+    final public const PHP_ENABLED = 'phpEnabled';
+    final public const ORIENTATION = 'orientation';
+    final public const SIZE = 'size';
+    final public const CHROOT = 'chroot';
 
     /**
      * @param array<string, mixed> $options
diff --git a/EMS/core-bundle/src/Entity/Channel.php b/EMS/core-bundle/src/Entity/Channel.php
index e5a023528..a6b2476b2 100644
--- a/EMS/core-bundle/src/Entity/Channel.php
+++ b/EMS/core-bundle/src/Entity/Channel.php
@@ -15,7 +15,7 @@ class Channel extends JsonDeserializer implements \JsonSerializable, EntityInter
 {
     use CreatedModifiedTrait;
 
-    private UuidInterface $id;
+    private readonly UuidInterface $id;
     protected string $name = '';
     /** @var string */
     protected $alias;
diff --git a/EMS/core-bundle/src/Entity/Dashboard.php b/EMS/core-bundle/src/Entity/Dashboard.php
index 3d9bfb098..d9045576d 100644
--- a/EMS/core-bundle/src/Entity/Dashboard.php
+++ b/EMS/core-bundle/src/Entity/Dashboard.php
@@ -16,7 +16,7 @@ class Dashboard extends JsonDeserializer implements \JsonSerializable, EntityInt
 {
     use CreatedModifiedTrait;
 
-    private UuidInterface $id;
+    private readonly UuidInterface $id;
     protected string $name;
     protected string $icon;
     protected string $label;
diff --git a/EMS/core-bundle/src/Entity/Form.php b/EMS/core-bundle/src/Entity/Form.php
index a5651238e..78a2397c1 100644
--- a/EMS/core-bundle/src/Entity/Form.php
+++ b/EMS/core-bundle/src/Entity/Form.php
@@ -16,7 +16,7 @@ class Form extends JsonDeserializer implements \JsonSerializable, EntityInterfac
 {
     use CreatedModifiedTrait;
 
-    private UuidInterface $id;
+    private readonly UuidInterface $id;
     protected string $name;
     protected string $label;
     protected int $orderKey;
diff --git a/EMS/core-bundle/src/Entity/FormVerification.php b/EMS/core-bundle/src/Entity/FormVerification.php
index 639a54e0e..988ab32c4 100644
--- a/EMS/core-bundle/src/Entity/FormVerification.php
+++ b/EMS/core-bundle/src/Entity/FormVerification.php
@@ -9,15 +9,15 @@
 
 class FormVerification
 {
-    private UuidInterface $id;
+    private readonly UuidInterface $id;
 
-    private string $code;
-    private \DateTimeImmutable $created;
+    private readonly string $code;
+    private readonly \DateTimeImmutable $created;
     private \DateTimeImmutable $expirationDate;
 
     private const EXPIRATION_TIME = '+3 hours';
 
-    public function __construct(private string $value)
+    public function __construct(private readonly string $value)
     {
         $now = new \DateTimeImmutable();
 
diff --git a/EMS/core-bundle/src/Entity/QuerySearch.php b/EMS/core-bundle/src/Entity/QuerySearch.php
index 49dbba6c1..b8a66d79b 100644
--- a/EMS/core-bundle/src/Entity/QuerySearch.php
+++ b/EMS/core-bundle/src/Entity/QuerySearch.php
@@ -18,7 +18,7 @@ class QuerySearch extends JsonDeserializer implements \JsonSerializable, EntityI
 {
     use CreatedModifiedTrait;
 
-    private UuidInterface $id;
+    private readonly UuidInterface $id;
     protected string $label;
     protected string $name = '';
     /** @var Collection <int,Environment> */
diff --git a/EMS/core-bundle/src/Entity/Task.php b/EMS/core-bundle/src/Entity/Task.php
index 58fbc7c8c..faa52c80d 100644
--- a/EMS/core-bundle/src/Entity/Task.php
+++ b/EMS/core-bundle/src/Entity/Task.php
@@ -17,7 +17,7 @@ class Task implements EntityInterface
 {
     use CreatedModifiedTrait;
 
-    private UuidInterface $id;
+    private readonly UuidInterface $id;
     private string $title;
     private string $status = self::STATUS_PLANNED;
     private int $delay;
@@ -26,7 +26,6 @@ class Task implements EntityInterface
     private ?string $description = null;
     /** @var array<mixed> */
     private array $logs;
-    private string $createdBy;
 
     final public const STATUS_PROGRESS = 'progress';
     final public const STATUS_PLANNED = 'planned';
@@ -42,12 +41,11 @@ class Task implements EntityInterface
         self::STATUS_APPROVED => ['icon' => 'fa fa-check', 'bg' => 'green', 'text' => 'success', 'label' => 'success'],
     ];
 
-    public function __construct(string $username)
+    public function __construct(private string $createdBy)
     {
         $this->id = Uuid::uuid4();
         $this->created = DateTime::create('now');
         $this->modified = DateTime::create('now');
-        $this->createdBy = $username;
     }
 
     public function addLog(TaskLog $taskLog): void
diff --git a/EMS/core-bundle/src/Entity/WysiwygStylesSet.php b/EMS/core-bundle/src/Entity/WysiwygStylesSet.php
index a25904fe2..041c71690 100644
--- a/EMS/core-bundle/src/Entity/WysiwygStylesSet.php
+++ b/EMS/core-bundle/src/Entity/WysiwygStylesSet.php
@@ -21,7 +21,7 @@ class WysiwygStylesSet extends JsonDeserializer implements \JsonSerializable, En
     protected ?string $contentCss = null;
     protected ?string $contentJs = null;
     /** @var ?array<string, mixed> */
-    protected ?array $assets;
+    protected ?array $assets = null;
     protected ?string $saveDir = null;
 
     public function __construct()
diff --git a/EMS/core-bundle/src/Resources/DoctrineMigrations/pdo_mysql/Version20231210131505.php b/EMS/core-bundle/src/Resources/DoctrineMigrations/pdo_mysql/Version20231210131505.php
index 658fb3265..7b5d15c86 100644
--- a/EMS/core-bundle/src/Resources/DoctrineMigrations/pdo_mysql/Version20231210131505.php
+++ b/EMS/core-bundle/src/Resources/DoctrineMigrations/pdo_mysql/Version20231210131505.php
@@ -56,7 +56,7 @@ public function down(Schema $schema): void
         while ($userRow = $userRoles->fetchAssociative()) {
             $this->addSql('UPDATE user SET roles = :roles WHERE id = :id', [
                 'id' => $userRow['id'],
-                'roles' => \serialize(\json_decode($userRow['roles'])),
+                'roles' => \serialize(\json_decode((string) $userRow['roles'])),
             ]);
         }
 
@@ -64,7 +64,7 @@ public function down(Schema $schema): void
         while ($uploadAsset = $uploadAssets->fetchAssociative()) {
             $this->addSql('UPDATE uploaded_asset SET head_in = :head_in WHERE id = :id', [
                 'id' => $uploadAsset['id'],
-                'head_in' => \serialize(\json_decode($uploadAsset['head_in'])),
+                'head_in' => \serialize(\json_decode((string) $uploadAsset['head_in'])),
             ]);
         }
     }
diff --git a/EMS/core-bundle/src/Resources/DoctrineMigrations/pdo_pgsql/Version20231210103056.php b/EMS/core-bundle/src/Resources/DoctrineMigrations/pdo_pgsql/Version20231210103056.php
index 02c6e8f13..12f4473f9 100644
--- a/EMS/core-bundle/src/Resources/DoctrineMigrations/pdo_pgsql/Version20231210103056.php
+++ b/EMS/core-bundle/src/Resources/DoctrineMigrations/pdo_pgsql/Version20231210103056.php
@@ -60,7 +60,7 @@ public function down(Schema $schema): void
         while ($userRow = $userRoles->fetchAssociative()) {
             $this->addSql('UPDATE "user" SET roles = :roles WHERE id = :id', [
                 'id' => $userRow['id'],
-                'roles' => \serialize(\json_decode($userRow['roles'])),
+                'roles' => \serialize(\json_decode((string) $userRow['roles'])),
             ]);
         }
 
@@ -68,7 +68,7 @@ public function down(Schema $schema): void
         while ($uploadAsset = $uploadAssets->fetchAssociative()) {
             $this->addSql('UPDATE uploaded_asset SET head_in = :head_in WHERE id = :id', [
                 'id' => $uploadAsset['id'],
-                'head_in' => \serialize(\json_decode($uploadAsset['head_in'])),
+                'head_in' => \serialize(\json_decode((string) $uploadAsset['head_in'])),
             ]);
         }
     }
diff --git a/EMS/submission-bundle/src/Entity/FormSubmission.php b/EMS/submission-bundle/src/Entity/FormSubmission.php
index 20f0eb18c..b252804e6 100644
--- a/EMS/submission-bundle/src/Entity/FormSubmission.php
+++ b/EMS/submission-bundle/src/Entity/FormSubmission.php
@@ -17,18 +17,18 @@ class FormSubmission implements EntityInterface
 {
     use CreatedModifiedTrait;
 
-    private UuidInterface $id;
-    private string $name;
-    private string $instance;
-    private string $locale;
+    private readonly UuidInterface $id;
+    private readonly string $name;
+    private readonly string $instance;
+    private readonly string $locale;
 
     /** @var array<string, mixed>|null */
     private ?array $data;
     /** @var Collection<int, FormSubmissionFile> */
     protected Collection $files;
 
-    private ?\DateTime $expireDate;
-    private string $label;
+    private readonly ?\DateTime $expireDate;
+    private readonly string $label;
     private int $processTryCounter = 0;
     private ?string $processId = null;
     private ?string $processBy = null;
diff --git a/EMS/submission-bundle/src/Entity/FormSubmissionFile.php b/EMS/submission-bundle/src/Entity/FormSubmissionFile.php
index 5cf66b5e6..e1d96d3da 100644
--- a/EMS/submission-bundle/src/Entity/FormSubmissionFile.php
+++ b/EMS/submission-bundle/src/Entity/FormSubmissionFile.php
@@ -15,13 +15,13 @@ class FormSubmissionFile implements EntityInterface
 {
     use CreatedModifiedTrait;
 
-    private UuidInterface $id;
+    private readonly UuidInterface $id;
     /** @var string|resource */
     private $file;
-    private string $filename;
-    private string $formField;
-    private string $mimeType;
-    private string $size;
+    private readonly string $filename;
+    private readonly string $formField;
+    private readonly string $mimeType;
+    private readonly string $size;
 
     /**
      * @param array<string, string> $file