Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Hotfix: default value for headers is string not null #204

Merged
merged 3 commits into from
Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/Header/AuthenticationInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ public static function fromString($headerLine)
}

// @todo implementation details
$header = new static($value);

return $header;
return new static($value);
}

public function __construct($value = null)
{
if ($value) {
if ($value !== null) {
HeaderValue::assertValid($value);
$this->value = $value;
}
Expand All @@ -51,7 +49,7 @@ public function getFieldName()

public function getFieldValue()
{
return $this->value;
return (string) $this->value;
}

public function toString()
Expand Down
8 changes: 3 additions & 5 deletions src/Header/Authorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ public static function fromString($headerLine)
}

// @todo implementation details
$header = new static($value);

return $header;
return new static($value);
}

public function __construct($value = null)
{
if ($value) {
if ($value !== null) {
HeaderValue::assertValid($value);
$this->value = $value;
}
Expand All @@ -51,7 +49,7 @@ public function getFieldName()

public function getFieldValue()
{
return $this->value;
return (string) $this->value;
}

public function toString()
Expand Down
8 changes: 3 additions & 5 deletions src/Header/ContentDisposition.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ public static function fromString($headerLine)
}

// @todo implementation details
$header = new static($value);

return $header;
return new static($value);
}

public function __construct($value = null)
{
if ($value) {
if ($value !== null) {
HeaderValue::assertValid($value);
$this->value = $value;
}
Expand All @@ -51,7 +49,7 @@ public function getFieldName()

public function getFieldValue()
{
return $this->value;
return (string) $this->value;
}

public function toString()
Expand Down
8 changes: 3 additions & 5 deletions src/Header/ContentEncoding.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ public static function fromString($headerLine)
}

// @todo implementation details
$header = new static($value);

return $header;
return new static($value);
}

public function __construct($value = null)
{
if ($value) {
if ($value !== null) {
HeaderValue::assertValid($value);
$this->value = $value;
}
Expand All @@ -50,7 +48,7 @@ public function getFieldName()

public function getFieldValue()
{
return $this->value;
return (string) $this->value;
}

public function toString()
Expand Down
8 changes: 3 additions & 5 deletions src/Header/ContentLanguage.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ public static function fromString($headerLine)
}

// @todo implementation details
$header = new static($value);

return $header;
return new static($value);
}

public function __construct($value = null)
{
if ($value) {
if ($value !== null) {
HeaderValue::assertValid($value);
$this->value = $value;
}
Expand All @@ -51,7 +49,7 @@ public function getFieldName()

public function getFieldValue()
{
return $this->value;
return (string) $this->value;
}

public function toString()
Expand Down
6 changes: 2 additions & 4 deletions src/Header/ContentLength.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ public static function fromString($headerLine)
}

// @todo implementation details
$header = new static($value);

return $header;
return new static($value);
}

public function __construct($value = null)
Expand All @@ -51,7 +49,7 @@ public function getFieldName()

public function getFieldValue()
{
return $this->value;
return (string) $this->value;
}

public function toString()
Expand Down
8 changes: 3 additions & 5 deletions src/Header/ContentMD5.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ public static function fromString($headerLine)
}

// @todo implementation details
$header = new static($value);

return $header;
return new static($value);
}

public function __construct($value = null)
{
if ($value) {
if ($value !== null) {
HeaderValue::assertValid($value);
$this->value = $value;
}
Expand All @@ -48,7 +46,7 @@ public function getFieldName()

public function getFieldValue()
{
return $this->value;
return (string) $this->value;
}

public function toString()
Expand Down
8 changes: 3 additions & 5 deletions src/Header/ContentRange.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ public static function fromString($headerLine)
}

// @todo implementation details
$header = new static($value);

return $header;
return new static($value);
}

public function __construct($value = null)
{
if ($value) {
if ($value !== null) {
HeaderValue::assertValid($value);
$this->value = $value;
}
Expand All @@ -51,7 +49,7 @@ public function getFieldName()

public function getFieldValue()
{
return $this->value;
return (string) $this->value;
}

public function toString()
Expand Down
8 changes: 3 additions & 5 deletions src/Header/ContentTransferEncoding.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ public static function fromString($headerLine)
}

// @todo implementation details
$header = new static(strtolower($value));

return $header;
return new static(strtolower($value));
}

public function __construct($value = null)
{
if ($value) {
if ($value !== null) {
HeaderValue::assertValid($value);
$this->value = $value;
}
Expand All @@ -51,7 +49,7 @@ public function getFieldName()

public function getFieldValue()
{
return $this->value;
return (string) $this->value;
}

public function toString()
Expand Down
6 changes: 3 additions & 3 deletions src/Header/ContentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static function fromString($headerLine)

public function __construct($value = null, $mediaType = null)
{
if ($value) {
if ($value !== null) {
HeaderValue::assertValid($value);
$this->value = $value;
}
Expand Down Expand Up @@ -146,7 +146,7 @@ public function getFieldName()
public function getFieldValue()
{
if (null !== $this->value) {
return $this->value;
return (string) $this->value;
}
return $this->assembleValue();
}
Expand All @@ -172,7 +172,7 @@ public function setMediaType($mediaType)
*/
public function getMediaType()
{
return $this->mediaType;
return (string) $this->mediaType;
}

/**
Expand Down
8 changes: 3 additions & 5 deletions src/Header/Etag.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ public static function fromString($headerLine)
}

// @todo implementation details
$header = new static($value);

return $header;
return new static($value);
}

public function __construct($value = null)
{
if ($value) {
if ($value !== null) {
HeaderValue::assertValid($value);
$this->value = $value;
}
Expand All @@ -48,7 +46,7 @@ public function getFieldName()

public function getFieldValue()
{
return $this->value;
return (string) $this->value;
}

public function toString()
Expand Down
8 changes: 3 additions & 5 deletions src/Header/Expect.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ public static function fromString($headerLine)
}

// @todo implementation details
$header = new static($value);

return $header;
return new static($value);
}

public function __construct($value = null)
{
if ($value) {
if ($value !== null) {
HeaderValue::assertValid($value);
$this->value = $value;
}
Expand All @@ -48,7 +46,7 @@ public function getFieldName()

public function getFieldValue()
{
return $this->value;
return (string) $this->value;
}

public function toString()
Expand Down
8 changes: 3 additions & 5 deletions src/Header/From.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ public static function fromString($headerLine)
}

// @todo implementation details
$header = new static($value);

return $header;
return new static($value);
}

public function __construct($value = null)
{
if ($value) {
if ($value !== null) {
HeaderValue::assertValid($value);
$this->value = $value;
}
Expand All @@ -48,7 +46,7 @@ public function getFieldName()

public function getFieldValue()
{
return $this->value;
return (string) $this->value;
}

public function toString()
Expand Down
8 changes: 3 additions & 5 deletions src/Header/Host.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ public static function fromString($headerLine)
}

// @todo implementation details
$header = new static($value);

return $header;
return new static($value);
}

public function __construct($value = null)
{
if ($value) {
if ($value !== null) {
HeaderValue::assertValid($value);
$this->value = $value;
}
Expand All @@ -48,7 +46,7 @@ public function getFieldName()

public function getFieldValue()
{
return $this->value;
return (string) $this->value;
}

public function toString()
Expand Down
8 changes: 3 additions & 5 deletions src/Header/IfMatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ public static function fromString($headerLine)
}

// @todo implementation details
$header = new static($value);

return $header;
return new static($value);
}

public function __construct($value = null)
{
if ($value) {
if ($value !== null) {
HeaderValue::assertValid($value);
$this->value = $value;
}
Expand All @@ -48,7 +46,7 @@ public function getFieldName()

public function getFieldValue()
{
return $this->value;
return (string) $this->value;
}

public function toString()
Expand Down
Loading