Skip to content

Commit 3be5979

Browse files
committed
Move DataType definition
1 parent f433ea1 commit 3be5979

File tree

7 files changed

+15
-8
lines changed

7 files changed

+15
-8
lines changed

src/Dictionary.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* @see https://www.rfc-editor.org/rfc/rfc8941.html#section-3.2
2222
*
2323
* @implements MemberOrderedMap<string, Value|InnerList<int, Value>>
24-
* @phpstan-import-type DataType from Item
24+
* @phpstan-import-type DataType from Value
2525
*/
2626
final class Dictionary implements MemberOrderedMap
2727
{

src/InnerList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/**
2020
* @see https://www.rfc-editor.org/rfc/rfc8941.html#section-3.1.1
2121
* @implements MemberList<int, Value>
22-
* @phpstan-import-type DataType from Item
22+
* @phpstan-import-type DataType from Value
2323
*/
2424
final class InnerList implements MemberList, ParameterAccess
2525
{

src/Item.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
/**
2626
* @see https://www.rfc-editor.org/rfc/rfc8941.html#section-3.3
27-
* @phpstan-type DataType ByteSequence|Token|DateTimeInterface|Stringable|string|int|float|bool
27+
* @phpstan-import-type DataType from Value
2828
*/
2929
final class Item implements Value
3030
{
@@ -122,7 +122,7 @@ public static function from(mixed $value, iterable $parameters = []): self
122122
$parameters = $value->parameters()->mergeAssociative($parameters);
123123
}
124124

125-
return new self(match (true) { /* @phpstan-ignore-line */
125+
return new self(match (true) {
126126
$value instanceof Value => $value->value(),
127127
$value instanceof DateTimeInterface => self::filterDate($value),
128128
is_int($value) => self::filterIntegerRange($value, 'Integer'),

src/OuterList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* @see https://www.rfc-editor.org/rfc/rfc8941.html#name-lists
2121
*
2222
* @implements MemberList<int, Value|InnerList<int, Value>>
23-
* @phpstan-import-type DataType from Item
23+
* @phpstan-import-type DataType from Value
2424
*/
2525
final class OuterList implements MemberList
2626
{

src/Parameters.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/**
2020
* @see https://www.rfc-editor.org/rfc/rfc8941.html#section-3.1.2
2121
* @implements MemberOrderedMap<string, Value>
22-
* @phpstan-import-type DataType from Item
22+
* @phpstan-import-type DataType from Value
2323
*/
2424
final class Parameters implements MemberOrderedMap
2525
{

src/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* @internal Use Dictionary::fromHttpValue(), Parameters::fromHttpValue(),
2626
* OuterList::fromHttpValue(), InnerList::fromHttpValue() or Item::fromHttpValue() instead
2727
*
28-
* @phpstan-import-type DataType from Item
28+
* @phpstan-import-type DataType from Value
2929
*/
3030
final class Parser
3131
{

src/Value.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@
44

55
namespace Bakame\Http\StructuredFields;
66

7+
use DateTimeImmutable;
8+
use DateTimeInterface;
9+
use Stringable;
10+
11+
/**
12+
* @phpstan-type DataType ByteSequence|Token|DateTimeInterface|Stringable|string|int|float|bool
13+
*/
714
interface Value extends ParameterAccess, StructuredField
815
{
916
/**
1017
* Returns the underlying value.
1118
*/
12-
public function value(): mixed;
19+
public function value(): ByteSequence|Token|DateTimeImmutable|string|int|float|bool;
1320

1421
/**
1522
* Returns the value type.

0 commit comments

Comments
 (0)