2020use Symfony \Contracts \HttpClient \ResponseInterface ;
2121
2222/**
23- * @phpstan-import-type Options from \CleverAge\RestProcessBundle\Task\RequestTask
23+ * @phpstan-import-type RequestOptions from \CleverAge\RestProcessBundle\Task\RequestTask
2424 */
2525class Client implements ClientInterface
2626{
@@ -53,7 +53,7 @@ public function setUri(string $uri): void
5353 }
5454
5555 /**
56- * @param Options $options
56+ * @param RequestOptions $options
5757 *
5858 * @throws RestRequestException
5959 */
@@ -116,28 +116,31 @@ protected function configureOptions(OptionsResolver $resolver): void
116116 }
117117
118118 /**
119- * @param Options $options
119+ * @param RequestOptions $options
120120 *
121- * @return Options
121+ * @return RequestOptions
122122 */
123123 protected function getOptions (array $ options = []): array
124124 {
125125 $ resolver = new OptionsResolver ();
126126 $ this ->configureOptions ($ resolver );
127127
128- return $ resolver ->resolve ($ options );
128+ /** @var RequestOptions $resolved */
129+ $ resolved = $ resolver ->resolve ($ options );
130+
131+ return $ resolved ;
129132 }
130133
131134 /**
132- * @param Options $options
135+ * @param RequestOptions $options
133136 */
134137 protected function getRequestUri (array $ options = []): string
135138 {
136139 return $ this ->replaceParametersInUri ($ this ->constructUri ($ options ), $ options );
137140 }
138141
139142 /**
140- * @param Options $options
143+ * @param RequestOptions $options
141144 *
142145 * @return array{
143146 * 'headers': array<mixed>,
@@ -168,7 +171,7 @@ protected function getRequestOptions(array $options = []): array
168171 }
169172
170173 /**
171- * @param Options $options
174+ * @param RequestOptions $options
172175 */
173176 protected function constructUri (array $ options ): string
174177 {
@@ -183,18 +186,20 @@ protected function getApiUrl(): string
183186 }
184187
185188 /**
186- * @param Options $options
189+ * @param RequestOptions $options
187190 */
188191 protected function replaceParametersInUri (string $ uri , array $ options = []): string
189192 {
190193 if ($ options ['url_parameters ' ]) {
194+ /** @var array<string> $search */
191195 $ search = array_keys ($ options ['url_parameters ' ]);
192196 array_walk (
193197 $ search ,
194198 static function (&$ item , $ key ) {
195199 $ item = '{ ' .$ item .'} ' ;
196200 }
197201 );
202+ /** @var array<string> $replace */
198203 $ replace = array_values ($ options ['url_parameters ' ]);
199204 array_walk (
200205 $ replace ,
0 commit comments