Skip to content

Commit 4152295

Browse files
committed
Fixed more Psalm issues
1 parent 6f9c4d3 commit 4152295

File tree

4 files changed

+10
-25
lines changed

4 files changed

+10
-25
lines changed

src/Command/ApiKey/ApiKeyHelper.php

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -90,35 +90,20 @@ public function getApiKeyMessage(string $message, ApiKey $apiKey): array
9090
*/
9191
private function getApiKeyEntity(SymfonyStyle $io, string $question): ?ApiKey
9292
{
93+
/** @var array<string, string> $choices */
9394
$choices = [];
9495

95-
array_map(
96-
$this->getApiKeyIterator($choices),
97-
$this->apiKeyResource->find(orderBy: [
98-
'token' => 'ASC',
99-
])
100-
);
101-
102-
$choices['Exit'] = 'Exit command';
103-
104-
return $this->apiKeyResource->findOne((string)$io->choice($question, $choices));
105-
}
106-
107-
/**
108-
* Method to return ApiKeyIterator closure. This will format ApiKey
109-
* entities for choice list.
110-
*
111-
* @param array<string, string> $choices
112-
*/
113-
private function getApiKeyIterator(array &$choices): Closure
114-
{
115-
return function (ApiKey $apiKey) use (&$choices): void {
96+
foreach ($this->apiKeyResource->find(orderBy: ['token' => 'ASC']) as $apiKey) {
11697
$choices[$apiKey->getId()] = sprintf(
11798
'[Token: %s] %s - Roles: %s',
11899
$apiKey->getToken(),
119100
$apiKey->getDescription(),
120101
implode(', ', $this->rolesService->getInheritedRoles($apiKey->getRoles())),
121102
);
122-
};
103+
}
104+
105+
$choices['Exit'] = 'Exit command';
106+
107+
return $this->apiKeyResource->findOne((string)$io->choice($question, $choices));
123108
}
124109
}

src/Command/ApiKey/ListApiKeysCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6969
/**
7070
* Getter method for formatted API key rows for console table.
7171
*
72-
* @return array<int, string>
72+
* @return array<array-key, mixed>
7373
*
7474
* @throws Throwable
7575
*/

src/Command/User/ListUserGroupsCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6767
/**
6868
* Getter method for formatted user group rows for console table.
6969
*
70-
* @return array<int, string>
70+
* @return array<array-key, mixed>
7171
*
7272
* @throws Throwable
7373
*/

src/Command/User/ListUsersCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7171
/**
7272
* Getter method for formatted user rows for console table.
7373
*
74-
* @return array<int, string>
74+
* @return array<array-key, mixed>
7575
*
7676
* @throws Throwable
7777
*/

0 commit comments

Comments
 (0)