Skip to content

Commit 21d624a

Browse files
committed
Fixed more Psalm issues
1 parent bf6186b commit 21d624a

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
@@ -92,35 +92,20 @@ public function getApiKeyMessage(string $message, ApiKey $apiKey): array
9292
*/
9393
private function getApiKeyEntity(SymfonyStyle $io, string $question): ?ApiKey
9494
{
95+
/** @var array<string, string> $choices */
9596
$choices = [];
9697

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

src/Command/ApiKey/ListApiKeysCommand.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 API key rows for console table.
7373
*
74-
* @return array<int, string>
74+
* @return array<array-key, mixed>
7575
*
7676
* @throws Throwable
7777
*/

src/Command/User/ListUserGroupsCommand.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 user group rows for console table.
7171
*
72-
* @return array<int, string>
72+
* @return array<array-key, mixed>
7373
*
7474
* @throws Throwable
7575
*/

src/Command/User/ListUsersCommand.php

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

0 commit comments

Comments
 (0)