Skip to content

Commit 677fbdf

Browse files
committed
Remove Item::fromDate named constructor
1 parent b880d4a commit 677fbdf

File tree

3 files changed

+4
-27
lines changed

3 files changed

+4
-27
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,13 @@ so they all expect an associative iterable to represents the parameters.
291291
use Bakame\Http\StructuredFields\Item;
292292
use Bakame\Http\StructuredFields\Value;
293293

294-
Item::from($value, iterable<string, Value> $associativeParameters = []): self;
295-
Item::fromPair(array{0:mixed, 1:iterable<array{0:string, 1:Value}>} $pair): self;
294+
//@type DataType ByteSequence|Token|DateTimeInterface|Stringable|string|int|float|bool
295+
296+
Item::from(DataType $value, iterable<string, Value> $associativeParameters = []): self;
297+
Item::fromPair(array{0:DataType, 1:iterable<array{0:string, 1:DataType}>} $pair): self;
296298
Item::fromDecodedByteSequence(string $value): self;
297299
Item::fromEncodedByteSequence(string $value): self;
298300
Item::fromToken(string $value): self;
299-
Item::fromDate(DateTimeInterface $datetime): self;
300301
Item::fromTimestamp(int $value): self;
301302
Item::fromDateFormat(string $format, string $datetime): self;
302303
Item::fromDateString(string $datetime, DateTimeZone|string|null $timezone): self;

src/Item.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,6 @@ public static function fromToken(Stringable|string $value): self
126126
return self::from(Token::fromString($value));
127127
}
128128

129-
/**
130-
* Returns a new instance from a Token and an iterable of key-value parameters.
131-
*/
132-
public static function fromDate(DateTimeInterface $datetime): self
133-
{
134-
return self::from($datetime);
135-
}
136-
137129
/**
138130
* Returns a new instance from a timestamp and an iterable of key-value parameters.
139131
*/

src/ItemTest.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,6 @@ public function it_fails_to_instantiate_an_out_of_range_timestamp_in_the_future(
149149
Item::fromTimestamp(1_000_000_000_000_000);
150150
}
151151

152-
#[Test]
153-
public function it_fails_to_instantiate_an_out_of_range_date_instance_in_the_future(): void
154-
{
155-
$this->expectException(SyntaxError::class);
156-
157-
Item::fromDate(new DateTime('@'. 1_000_000_000_000_000));
158-
}
159-
160152
#[Test]
161153
public function it_fails_to_instantiate_an_out_of_range_date_in_the_past(): void
162154
{
@@ -165,14 +157,6 @@ public function it_fails_to_instantiate_an_out_of_range_date_in_the_past(): void
165157
Item::from(new DateTime('@'.-1_000_000_000_000_000));
166158
}
167159

168-
#[Test]
169-
public function it_fails_to_instantiate_an_out_of_range_date_instance_in_the_past(): void
170-
{
171-
$this->expectException(SyntaxError::class);
172-
173-
Item::fromDate(new DateTime('@'.-1_000_000_000_000_000));
174-
}
175-
176160
#[Test]
177161
public function it_fails_to_instantiate_an_out_of_range_timestamp_in_the_past(): void
178162
{

0 commit comments

Comments
 (0)