From 700a62bcf2aeeb5b9007de07b225084fe76e6d0d Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Mon, 1 Jul 2019 18:00:09 +0200 Subject: [PATCH] Accept null, bool and float header values again This is not according to PSR-7 which says `@param string|string[] $value Header value(s).` but for BC and missing type declarations it makes sense. --- src/MessageTrait.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MessageTrait.php b/src/MessageTrait.php index b7cf98b5..a7966d10 100644 --- a/src/MessageTrait.php +++ b/src/MessageTrait.php @@ -186,9 +186,9 @@ private function normalizeHeaderValue($value) private function trimHeaderValues(array $values) { return array_map(function ($value) { - if (!is_string($value) && !is_numeric($value)) { + if (!is_scalar($value) && null !== $value) { throw new \InvalidArgumentException(sprintf( - 'Header value must be a string or numeric but %s provided.', + 'Header value must be scalar or null but %s provided.', is_object($value) ? get_class($value) : gettype($value) )); }