Skip to content

Commit 511790d

Browse files
authored
Merge pull request #42677 from nextcloud/backport/stable28/42377
[stable28] Return providers as indexed array
2 parents 9280e02 + a85ee2e commit 511790d

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lib/private/TextToImage/Manager.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
use Throwable;
5050

5151
class Manager implements IManager {
52-
/** @var ?IProvider[] */
52+
/** @var ?list<IProvider> */
5353
private ?array $providers = null;
5454
private IAppData $appData;
5555

@@ -66,7 +66,7 @@ public function __construct(
6666
}
6767

6868
/**
69-
* @inerhitDocs
69+
* @inheritDoc
7070
*/
7171
public function getProviders(): array {
7272
$context = $this->coordinator->getRegistrationContext();
@@ -83,7 +83,9 @@ public function getProviders(): array {
8383
foreach ($context->getTextToImageProviders() as $providerServiceRegistration) {
8484
$class = $providerServiceRegistration->getService();
8585
try {
86-
$this->providers[$class] = $this->serverContainer->get($class);
86+
/** @var IProvider $provider */
87+
$provider = $this->serverContainer->get($class);
88+
$this->providers[] = $provider;
8789
} catch (Throwable $e) {
8890
$this->logger->error('Failed to load Text to image provider ' . $class, [
8991
'exception' => $e,
@@ -313,7 +315,7 @@ public function getUserTasksByApp(?string $userId, string $appId, ?string $ident
313315
}
314316

315317
/**
316-
* @return IProvider[]
318+
* @return list<IProvider>
317319
*/
318320
private function getPreferredProviders() {
319321
$providers = $this->getProviders();

lib/public/TextToImage/IManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function hasProviders(): bool;
4545

4646
/**
4747
* @since 28.0.0
48-
* @return IProvider[]
48+
* @return list<IProvider>
4949
*/
5050
public function getProviders(): array;
5151

0 commit comments

Comments
 (0)