Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  add a template to specify the type of header values
  • Loading branch information
Baptouuuu committed Feb 15, 2020
2 parents 1615b96 + 0caa376 commit 5a7b973
Show file tree
Hide file tree
Showing 30 changed files with 92 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/Header.php
Expand Up @@ -5,12 +5,15 @@

use Innmind\Immutable\Set;

/**
* @template V of Header\Value
*/
interface Header
{
public function name(): string;

/**
* @return Set<Header\Value>
* @return Set<V>
*/
public function values(): Set;
public function toString(): string;
Expand Down
3 changes: 3 additions & 0 deletions src/Header/Accept.php
Expand Up @@ -3,6 +3,9 @@

namespace Innmind\Http\Header;

/**
* @extends Header<AcceptValue>
*/
final class Accept extends Header
{
public function __construct(AcceptValue $first, AcceptValue ...$values)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/AcceptCharset.php
Expand Up @@ -3,6 +3,9 @@

namespace Innmind\Http\Header;

/**
* @extends Header<AcceptCharsetValue>
*/
final class AcceptCharset extends Header
{
public function __construct(AcceptCharsetValue ...$values)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/AcceptEncoding.php
Expand Up @@ -3,6 +3,9 @@

namespace Innmind\Http\Header;

/**
* @extends Header<AcceptEncodingValue>
*/
final class AcceptEncoding extends Header
{
public function __construct(AcceptEncodingValue ...$values)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/AcceptLanguage.php
Expand Up @@ -3,6 +3,9 @@

namespace Innmind\Http\Header;

/**
* @extends Header<AcceptLanguageValue>
*/
final class AcceptLanguage extends Header
{
public function __construct(AcceptLanguageValue ...$values)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/AcceptRanges.php
Expand Up @@ -3,6 +3,9 @@

namespace Innmind\Http\Header;

/**
* @extends Header<AcceptRangesValue>
*/
final class AcceptRanges extends Header
{
public function __construct(AcceptRangesValue $ranges)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/Age.php
Expand Up @@ -3,6 +3,9 @@

namespace Innmind\Http\Header;

/**
* @extends Header<AgeValue>
*/
final class Age extends Header
{
public function __construct(AgeValue $age)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/Allow.php
Expand Up @@ -3,6 +3,9 @@

namespace Innmind\Http\Header;

/**
* @extends Header<AllowValue>
*/
final class Allow extends Header
{
public function __construct(AllowValue ...$values)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/Authorization.php
Expand Up @@ -3,6 +3,9 @@

namespace Innmind\Http\Header;

/**
* @extends Header<AuthorizationValue>
*/
final class Authorization extends Header
{
public function __construct(AuthorizationValue $authorization)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/CacheControl.php
Expand Up @@ -3,6 +3,9 @@

namespace Innmind\Http\Header;

/**
* @extends Header<CacheControlValue>
*/
final class CacheControl extends Header
{
public function __construct(CacheControlValue $first, CacheControlValue ...$values)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/ContentEncoding.php
Expand Up @@ -3,6 +3,9 @@

namespace Innmind\Http\Header;

/**
* @extends Header<ContentEncodingValue>
*/
final class ContentEncoding extends Header
{
public function __construct(ContentEncodingValue $encoding)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/ContentLanguage.php
Expand Up @@ -3,6 +3,9 @@

namespace Innmind\Http\Header;

/**
* @extends Header<ContentLanguageValue>
*/
final class ContentLanguage extends Header
{
public function __construct(ContentLanguageValue ...$values)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/ContentLength.php
Expand Up @@ -3,6 +3,9 @@

namespace Innmind\Http\Header;

/**
* @extends Header<ContentLengthValue>
*/
final class ContentLength extends Header
{
public function __construct(ContentLengthValue $length)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/ContentLocation.php
Expand Up @@ -5,6 +5,9 @@

use Innmind\Url\Url;

/**
* @extends Header<LocationValue>
*/
final class ContentLocation extends Header
{
public function __construct(LocationValue $location)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/ContentRange.php
Expand Up @@ -3,6 +3,9 @@

namespace Innmind\Http\Header;

/**
* @extends Header<ContentRangeValue>
*/
final class ContentRange extends Header
{
public function __construct(ContentRangeValue $range)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/ContentType.php
Expand Up @@ -3,6 +3,9 @@

namespace Innmind\Http\Header;

/**
* @extends Header<ContentTypeValue>
*/
final class ContentType extends Header
{
public function __construct(ContentTypeValue $content)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/Cookie.php
Expand Up @@ -3,6 +3,9 @@

namespace Innmind\Http\Header;

/**
* @extends Header<CookieValue>
*/
final class Cookie extends Header
{
public function __construct(CookieValue $value)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/Date.php
Expand Up @@ -5,6 +5,9 @@

use Innmind\TimeContinuum\PointInTime;

/**
* @extends Header<DateValue>
*/
final class Date extends Header
{
public function __construct(DateValue $date)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/Expires.php
Expand Up @@ -5,6 +5,9 @@

use Innmind\TimeContinuum\PointInTime;

/**
* @extends Header<DateValue>
*/
final class Expires extends Header
{
public function __construct(DateValue $date)
Expand Down
7 changes: 4 additions & 3 deletions src/Header/Header.php
Expand Up @@ -7,6 +7,10 @@
use Innmind\Immutable\Set;
use function Innmind\Immutable\join;

/**
* @template V of Value
* @implements HeaderInterface<V>
*/
class Header implements HeaderInterface
{
private string $name;
Expand All @@ -25,9 +29,6 @@ public function name(): string
return $this->name;
}

/**
* {@inheritdoc}
*/
public function values(): Set
{
return $this->values;
Expand Down
3 changes: 3 additions & 0 deletions src/Header/Host.php
Expand Up @@ -8,6 +8,9 @@
Port,
};

/**
* @extends Header<HostValue>
*/
final class Host extends Header
{
public function __construct(HostValue $host)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/IfModifiedSince.php
Expand Up @@ -5,6 +5,9 @@

use Innmind\TimeContinuum\PointInTime;

/**
* @extends Header<DateValue>
*/
final class IfModifiedSince extends Header
{
public function __construct(DateValue $date)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/IfUnmodifiedSince.php
Expand Up @@ -5,6 +5,9 @@

use Innmind\TimeContinuum\PointInTime;

/**
* @extends Header<DateValue>
*/
final class IfUnmodifiedSince extends Header
{
public function __construct(DateValue $date)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/LastModified.php
Expand Up @@ -5,6 +5,9 @@

use Innmind\TimeContinuum\PointInTime;

/**
* @extends Header<DateValue>
*/
final class LastModified extends Header
{
public function __construct(DateValue $date)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/Link.php
Expand Up @@ -3,6 +3,9 @@

namespace Innmind\Http\Header;

/**
* @extends Header<LinkValue>
*/
final class Link extends Header
{
public function __construct(LinkValue ...$values)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/Location.php
Expand Up @@ -5,6 +5,9 @@

use Innmind\Url\Url;

/**
* @extends Header<LocationValue>
*/
final class Location extends Header
{
public function __construct(LocationValue $location)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/Range.php
Expand Up @@ -3,6 +3,9 @@

namespace Innmind\Http\Header;

/**
* @extends Header<RangeValue>
*/
final class Range extends Header
{
public function __construct(RangeValue $range)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/Referrer.php
Expand Up @@ -5,6 +5,9 @@

use Innmind\Url\Url;

/**
* @extends Header<ReferrerValue>
*/
final class Referrer extends Header
{
public function __construct(ReferrerValue $referrer)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/SetCookie.php
Expand Up @@ -3,6 +3,9 @@

namespace Innmind\Http\Header;

/**
* @extends Header<CookieValue>
*/
final class SetCookie extends Header
{
public function __construct(CookieValue ...$values)
Expand Down
3 changes: 3 additions & 0 deletions src/Header/WWWAuthenticate.php
Expand Up @@ -3,6 +3,9 @@

namespace Innmind\Http\Header;

/**
* @extends Header<WWWAuthenticateValue>
*/
final class WWWAuthenticate extends Header
{
public function __construct(WWWAuthenticateValue ...$values)
Expand Down

0 comments on commit 5a7b973

Please sign in to comment.