2020use Gitlab \HttpClient \Util \JsonArray ;
2121use Gitlab \HttpClient \Util \QueryStringBuilder ;
2222use Http \Message \MultipartStream \MultipartStreamBuilder ;
23+ use Psr \Http \Message \ResponseInterface ;
2324use Psr \Http \Message \StreamInterface ;
2425use Symfony \Component \OptionsResolver \OptionsResolver ;
2526
@@ -74,7 +75,7 @@ public function __construct(Client $client)
7475 *
7576 * @return \Psr\Http\Message\ResponseInterface
7677 */
77- protected function getAsResponse (string $ uri , array $ params = [], array $ headers = [])
78+ protected function getAsResponse (string $ uri , array $ params = [], array $ headers = []): ResponseInterface
7879 {
7980 if (null !== $ this ->perPage && !isset ($ params ['per_page ' ])) {
8081 $ params ['per_page ' ] = $ this ->perPage ;
@@ -176,7 +177,7 @@ protected function delete(string $uri, array $params = [], array $headers = [])
176177 *
177178 * @return string
178179 */
179- protected static function encodePath ($ uri )
180+ protected static function encodePath ($ uri ): string
180181 {
181182 return \rawurlencode ((string ) $ uri );
182183 }
@@ -187,7 +188,7 @@ protected static function encodePath($uri)
187188 *
188189 * @return string
189190 */
190- protected function getProjectPath ($ id , string $ uri )
191+ protected function getProjectPath ($ id , string $ uri ): string
191192 {
192193 return 'projects/ ' .self ::encodePath ($ id ).'/ ' .$ uri ;
193194 }
@@ -197,18 +198,18 @@ protected function getProjectPath($id, string $uri)
197198 *
198199 * @return OptionsResolver
199200 */
200- protected function createOptionsResolver ()
201+ protected function createOptionsResolver (): OptionsResolver
201202 {
202203 $ resolver = new OptionsResolver ();
203204 $ resolver ->setDefined ('page ' )
204205 ->setAllowedTypes ('page ' , 'int ' )
205- ->setAllowedValues ('page ' , function ($ value ) {
206+ ->setAllowedValues ('page ' , function ($ value ): bool {
206207 return $ value > 0 ;
207208 })
208209 ;
209210 $ resolver ->setDefined ('per_page ' )
210211 ->setAllowedTypes ('per_page ' , 'int ' )
211- ->setAllowedValues ('per_page ' , function ($ value ) {
212+ ->setAllowedValues ('per_page ' , function ($ value ): bool {
212213 return $ value > 0 && $ value <= 100 ;
213214 })
214215 ;
@@ -224,7 +225,7 @@ protected function createOptionsResolver()
224225 *
225226 * @return string
226227 */
227- private static function prepareUri (string $ uri , array $ query = [])
228+ private static function prepareUri (string $ uri , array $ query = []): string
228229 {
229230 $ query = \array_filter ($ query , function ($ value ): bool {
230231 return null !== $ value ;
@@ -241,7 +242,7 @@ private static function prepareUri(string $uri, array $query = [])
241242 *
242243 * @return MultipartStreamBuilder
243244 */
244- private function createMultipartStreamBuilder (array $ params = [], array $ files = [])
245+ private function createMultipartStreamBuilder (array $ params = [], array $ files = []): MultipartStreamBuilder
245246 {
246247 $ builder = new MultipartStreamBuilder ($ this ->client ->getStreamFactory ());
247248
@@ -268,7 +269,7 @@ private function createMultipartStreamBuilder(array $params = [], array $files =
268269 *
269270 * @return StreamInterface
270271 */
271- private static function prepareMultipartBody (MultipartStreamBuilder $ builder )
272+ private static function prepareMultipartBody (MultipartStreamBuilder $ builder ): StreamInterface
272273 {
273274 return $ builder ->build ();
274275 }
@@ -281,7 +282,7 @@ private static function prepareMultipartBody(MultipartStreamBuilder $builder)
281282 *
282283 * @return array<string,string>
283284 */
284- private static function addMultipartContentType (array $ headers , MultipartStreamBuilder $ builder )
285+ private static function addMultipartContentType (array $ headers , MultipartStreamBuilder $ builder ): array
285286 {
286287 $ contentType = \sprintf ('%s; boundary=%s ' , ResponseMediator::MULTIPART_CONTENT_TYPE , $ builder ->getBoundary ());
287288
@@ -295,7 +296,7 @@ private static function addMultipartContentType(array $headers, MultipartStreamB
295296 *
296297 * @return string|null
297298 */
298- private static function prepareJsonBody (array $ params )
299+ private static function prepareJsonBody (array $ params ): ? string
299300 {
300301 $ params = \array_filter ($ params , function ($ value ): bool {
301302 return null !== $ value ;
@@ -315,7 +316,7 @@ private static function prepareJsonBody(array $params)
315316 *
316317 * @return array<string,string>
317318 */
318- private static function addJsonContentType (array $ headers )
319+ private static function addJsonContentType (array $ headers ): array
319320 {
320321 return \array_merge ([ResponseMediator::CONTENT_TYPE_HEADER => ResponseMediator::JSON_CONTENT_TYPE ], $ headers );
321322 }
@@ -365,7 +366,7 @@ private static function tryFopen(string $filename, string $mode)
365366 *
366367 * @return string
367368 */
368- private static function guessFileContentType (string $ file )
369+ private static function guessFileContentType (string $ file ): string
369370 {
370371 if (!\class_exists (\finfo::class, false )) {
371372 return ResponseMediator::STREAM_CONTENT_TYPE ;
0 commit comments