From 0456e433786ca1c847067cb7da68fd68af14baca Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 15 Jun 2023 12:53:14 +0200 Subject: [PATCH] fix: crash when leaving out system parameter The `--system` parameter can be supplied via command line or selected afterwards. However if none was provided the command would crash with `TypeError: Cannot assign null to property $system`. Handle that gracefully and make the type spec more precise for the setSystem function. Signed-off-by: Max --- lib/Service/Importer/BoardImportService.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Service/Importer/BoardImportService.php b/lib/Service/Importer/BoardImportService.php index 39c2273fe..657f938b2 100644 --- a/lib/Service/Importer/BoardImportService.php +++ b/lib/Service/Importer/BoardImportService.php @@ -143,11 +143,13 @@ class BoardImportService { } /** - * @param mixed $system + * @param ?string $system * @return self */ public function setSystem($system): self { - $this->system = $system; + if ($system) { + $this->system = $system; + } return $this; }