Skip to content

Commit 13c7be9

Browse files
committed
:octocat: use iterable where possible
1 parent 4aab0f9 commit 13c7be9

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/HeaderUtil.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class HeaderUtil{
2323
* An exception is being made for Set-Cookie, which holds an array of values for each cookie.
2424
* For multiple cookies with the same name, only the last value will be kept.
2525
*/
26-
public static function normalize(array $headers):array{
26+
public static function normalize(iterable $headers):array{
2727
$normalized = [];
2828

2929
foreach($headers as $key => $val){
@@ -98,8 +98,13 @@ public static function normalize(array $headers):array{
9898
*
9999
* @see https://tools.ietf.org/html/rfc7230#section-3.2.4
100100
*/
101-
public static function trimValues(array $values):array{
102-
return array_map(fn(string $value):string => trim($value, " \t"), $values);
101+
public static function trimValues(iterable $values):iterable{
102+
103+
foreach($values as &$value){
104+
$value = trim($value, " \t");
105+
}
106+
107+
return $values;
103108
}
104109

105110
/**

src/ServerUtil.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ public function createUriFromGlobals():UriInterface{
118118
/**
119119
* Returns an UploadedFile instance array.
120120
*
121-
* @param array $files An array which respect $_FILES structure
121+
* @param iterable $files An array which respects $_FILES structure
122122
*
123123
* @return \Psr\Http\Message\UploadedFileInterface[]
124124
* @throws \InvalidArgumentException for unrecognized values
125125
*/
126-
public function normalizeFiles(array $files):array{
126+
public function normalizeFiles(iterable $files):array{
127127
$normalized = [];
128128

129129
foreach($files as $key => $value){

0 commit comments

Comments
 (0)