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 <max@nextcloud.com>
This commit is contained in:
Max
2023-06-15 12:53:14 +02:00
committed by backportbot-nextcloud[bot]
parent 5cf3f48de9
commit 0456e43378

View File

@@ -143,11 +143,13 @@ class BoardImportService {
} }
/** /**
* @param mixed $system * @param ?string $system
* @return self * @return self
*/ */
public function setSystem($system): self { public function setSystem($system): self {
if ($system) {
$this->system = $system; $this->system = $system;
}
return $this; return $this;
} }