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
parent 4ddbf472c3
commit cfa9c4d1c4

View File

@@ -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;
}