@@ -93,7 +93,7 @@ public function withAddedHeader($name, $value): static
9393 if (isset ($ instance ->headersMap [$ header = \strtolower ($ name )])) {
9494 $ header = $ instance ->headersMap [$ header ];
9595 $ instance ->headers [$ header ] = \array_unique (
96- \array_merge_recursive ($ instance ->headers [$ header ], $ value )
96+ @ \array_merge_recursive ($ instance ->headers [$ header ], $ value )
9797 );
9898 } else {
9999 $ instance ->headersMap [$ header ] = $ name ;
@@ -203,15 +203,13 @@ protected function normalizeHeaderName(string $name): string
203203 *
204204 * @return array
205205 */
206- protected function normalizeHeaderValue (string $ name , $ value ): array
206+ protected function normalizeHeaderValue (string $ name , mixed $ value ): array
207207 {
208- if (false === \is_array ($ value )) {
208+ // if (false === \is_array($value)) {
209209 $ value = (array )$ value ;
210- }
210+ // }
211211 try {
212- if (empty ($ value = \array_map (function ($ v ): string {
213- return \trim (\preg_replace ('/\s+/ ' , ' ' , $ v ));
214- }, $ value ))) {
212+ if (empty ($ value = \array_map (fn ($ v ): string => \trim (\preg_replace ('/\s+/ ' , ' ' , $ v )), $ value ))) {
215213 throw new \InvalidArgumentException (
216214 \sprintf ('The value for header "%s" cannot be empty ' , $ name ),
217215 HttpStatus::BAD_REQUEST );
0 commit comments