public function __construct(MapInterface $headers) { if ((string) $headers->keyType() !== 'string' || (string) $headers->valueType() !== HeaderInterface::class) { throw new InvalidArgumentException(); } $this->headers = $headers->map(function (string $name, HeaderInterface $header) { return new Pair((string) (new Str($name))->toLower(), $header); }); }