Skip to content

Commit 074afd2

Browse files
committed
Make PHPStan happy
1 parent fe4feac commit 074afd2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

phpstan.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ parameters:
1111
ignoreErrors:
1212
- message: '#it_fails_to_create_an_item_from_an_array_of_pairs\(\)#'
1313
path: tests/ItemTest.php
14+
- message: '#Function http_build_structured_field\(\) has parameter \$data with no value type specified in iterable type iterable.#'
15+
path: src/functions.php
1416
reportUnmatchedIgnoredErrors: true

src/functions.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,12 @@ function http_parse_structured_field(string $type, string $httpValue): Structure
4747
*/
4848
function http_build_structured_field(string $type, iterable $data): string /* @phptan-ignore-line */
4949
{
50-
$data = [...$data];
51-
5250
return match ($type) {
5351
'dictionary' => Dictionary::fromPairs($data)->toHttpValue(),
5452
'parameters' => Parameters::fromPairs($data)->toHttpValue(),
5553
'list' => OuterList::fromPairs($data)->toHttpValue(),
56-
'innerlist' => InnerList::fromPair($data)->toHttpValue(), /* @phpstan-ignore-line */
57-
'item' => Item::fromPair($data)->toHttpValue(), /* @phpstan-ignore-line */
54+
'innerlist' => InnerList::fromPair([...$data])->toHttpValue(), /* @phpstan-ignore-line */
55+
'item' => Item::fromPair([...$data])->toHttpValue(), /* @phpstan-ignore-line */
5856
default => throw new OutOfBoundsException('The submitted type "'.$type.'" is unknown or not supported,'), /* @phpstan-ignore-line */
5957
};
6058
}

0 commit comments

Comments
 (0)