src/Viserio/Component/Http/AbstractMessage.php
public function withAddedHeader($header, $value): self
    {
        if (! \is_string($header)) {
            throw new InvalidArgumentException(\sprintf(
                'Invalid header name type; expected string; received [%s]',
                (\is_object($header) ? \get_class($header) : \gettype($header))
            ));
        }

        if (! $this->hasHeader($header)) {
            return $this->withHeader($header, $value);
        }

        HeaderSecurity::assertValidName($header);

        $header = \trim($header);
        $header = $this->headerNames[\strtolower($header)];

        $new                   = clone $this;
        $value                 = $this->filterHeaderValue($value);
        $new->headers[$header] = \array_merge($this->headers[$header], $value);

        return $new;
    }
public function withAddedHeader($header, $value): self
    {
        if (! \is_string($header)) {
            throw new InvalidArgumentException(\sprintf(
                'Invalid header name type; expected string; received [%s]',
                (\is_object($header) ? \get_class($header) : \gettype($header))
            ));
        }

        if (! $this->hasHeader($header)) {
            return $this->withHeader($header, $value);
        }

        HeaderSecurity::assertValidName($header);

        $header = \trim($header);
        $header = $this->headerNames[\strtolower($header)];

        $new                   = clone $this;
        $value                 = $this->filterHeaderValue($value);
        $new->headers[$header] = \array_merge($this->headers[$header], $value);

        return $new;
    }
{@inheritdoc}