Skip to content

Commit 2412969

Browse files
committed
fix: normalize architecture list type for psalm
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 31cbd36 commit 2412969

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

lib/Service/Install/SignSetupService.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,17 @@ public function setResource(string $resource): self {
7070

7171
public function getArchitectures(): array {
7272
$appInfo = $this->appManager->getAppInfo(Application::APP_ID);
73-
if (empty($appInfo['dependencies']['architecture'])) {
73+
$architectures = $appInfo['dependencies']['architecture'] ?? null;
74+
if (empty($architectures)) {
7475
throw new \Exception('dependencies>architecture not found at info.xml');
7576
}
76-
return $appInfo['dependencies']['architecture'];
77+
if (is_string($architectures)) {
78+
return [$architectures];
79+
}
80+
if (!is_array($architectures)) {
81+
throw new \Exception('dependencies>architecture has invalid format at info.xml');
82+
}
83+
return array_values(array_map(static fn (mixed $architecture): string => (string)$architecture, $architectures));
7784
}
7885

7986
public function setPrivateKey(PrivateKey $privateKey): void {

0 commit comments

Comments
 (0)