2828 * @phpstan-type AccessToken array{access_token: string, token_type: string, expires_in: int, refresh_token: string}
2929 * @phpstan-type ServiceIndex array<string, array{href: string, title: string}>
3030 * @phpstan-type OptionsInput array{
31- * api_uri: non-empty- string,
32- * api_username: non-empty- string,
33- * api_secret: non-empty- string,
34- * f2_username: non-empty- string,
31+ * api_uri: string,
32+ * api_username: string,
33+ * api_secret: string,
34+ * f2_username: string,
3535 * cache_item_pool: CacheItemPoolInterface,
3636 * cache_item_lifetime?: int,
3737 * }
38- * @phpstan-type Options array{
38+ * @phpstan-type OptionsResolved array{
3939 * api_uri: non-empty-string,
4040 * api_username: non-empty-string,
4141 * api_secret: non-empty-string,
@@ -48,7 +48,7 @@ class ApiClient
4848 use LoggerAwareTrait;
4949 use LoggerTrait;
5050
51- /** @var Options */
51+ /** @var OptionsResolved */
5252 private readonly array $ options ;
5353
5454 private ?HttpClientInterface $ client = null ;
@@ -61,7 +61,9 @@ public function __construct(array $options)
6161 $ resolver = new OptionsResolver ();
6262 $ this ->configureOptions ($ resolver );
6363
64- $ this ->options = $ resolver ->resolve ($ options );
64+ /** @var OptionsResolved $options */
65+ $ options = $ resolver ->resolve ($ options );
66+ $ this ->options = $ options ;
6567 }
6668
6769 /**
@@ -78,6 +80,7 @@ public function getServiceIndex(): array
7880 $ cache = $ this ->getCache ();
7981 $ cacheKey = sha1 (__METHOD__ );
8082
83+ // @mago-ignore analysis:less-specific-return-statement
8184 return $ cache ->get ($ cacheKey , function (CacheItemInterface $ item ): array {
8285 $ item ->expiresAfter ((int ) $ this ->options ['cache_item_lifetime ' ]);
8386
@@ -455,7 +458,6 @@ function (array $matches) use ($url, $values): string {
455458
456459 protected function getCache (): CacheInterface
457460 {
458- /** @var CacheItemPoolInterface $pool */
459461 $ pool = $ this ->options ['cache_item_pool ' ];
460462
461463 return new ProxyAdapter (pool: $ pool );
@@ -491,7 +493,7 @@ protected function createItemResult(ResponseInterface $response, string $class):
491493 {
492494 $ item = new \SimpleXMLElement ($ response ->getContent ());
493495
494- /* @var T */
496+ // @mago-ignore analysis:invalid-return-statement
495497 return $ class ::fromSimpleXMLElement ($ item );
496498 }
497499
0 commit comments