Skip to content

Commit

Permalink
Accept null, bool and float header values again
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Tobion committed Jul 1, 2019
1 parent dc78403 commit 700a62b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/MessageTrait.php
Expand Up @@ -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)
));
}
Expand Down

0 comments on commit 700a62b

Please sign in to comment.