Skip to content

Commit 0e63639

Browse files
committed
phpstan fix
1 parent 7197714 commit 0e63639

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

src/Annotations/Input/InputDateFormat.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
use Astral\Serialize\Support\Collections\DataCollection;
99
use Astral\Serialize\Support\Context\InputValueContext;
1010
use Attribute;
11-
use DateInvalidTimeZoneException;
1211
use DateTime;
13-
use DateTimeImmutable;
1412
use DateTimeInterface;
1513
use DateTimeZone;
1614

@@ -30,9 +28,7 @@ public function match(mixed $value, DataCollection $collection, InputValueContex
3028
return is_string($value) || is_numeric($value);
3129
}
3230

33-
/**
34-
* @throws DateInvalidTimeZoneException
35-
*/
31+
3632
public function resolve(mixed $value, DataCollection $collection, InputValueContext $context): string|DateTime
3733
{
3834

src/Annotations/Output/OutputDateFormat.php

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
use Astral\Serialize\Support\Collections\DataCollection;
99
use Astral\Serialize\Support\Context\OutContext;
1010
use Attribute;
11-
use DateInvalidTimeZoneException;
12-
use DateMalformedStringException;
1311
use DateTime;
1412
use DateTimeInterface;
1513
use DateTimeZone;
14+
use Exception;
1615

1716
/**
1817
* toArray 输出值为 固定日期格式 默认 YYYY-MM-DD HH:ii:ss的日期格式
@@ -31,19 +30,12 @@ public function match(mixed $value, DataCollection $collection, OutContext $cont
3130
return is_string($value) || is_numeric($value) || is_subclass_of($value, DateTimeInterface::class);
3231
}
3332

34-
/**
35-
* @throws DateMalformedStringException
36-
* @throws DateInvalidTimeZoneException
37-
*/
33+
3834
public function resolve(mixed $value, DataCollection $collection, OutContext $context): string|DateTime|null
3935
{
4036
return $this->formatValue($value);
4137
}
4238

43-
/**
44-
* @throws DateMalformedStringException
45-
* @throws DateInvalidTimeZoneException
46-
*/
4739
private function formatValue(mixed $value): ?string
4840
{
4941
$timezone = $this->timezone ? new DateTimeZone($this->timezone) : null;
@@ -57,7 +49,7 @@ private function formatValue(mixed $value): ?string
5749
}
5850

5951
/**
60-
* @throws DateMalformedStringException
52+
* @throws Exception
6153
*/
6254
private function formatDateTime(DateTimeInterface $dateTime, ?DateTimeZone $timezone): string
6355
{
@@ -69,7 +61,7 @@ private function formatDateTime(DateTimeInterface $dateTime, ?DateTimeZone $time
6961
}
7062

7163
/**
72-
* @throws DateMalformedStringException
64+
* @throws Exception
7365
*/
7466
private function formatTimestamp(int $timestamp, ?DateTimeZone $timezone): string
7567
{
@@ -82,7 +74,7 @@ private function formatTimestamp(int $timestamp, ?DateTimeZone $timezone): strin
8274
}
8375

8476
/**
85-
* @throws DateMalformedStringException
77+
* @throws Exception
8678
*/
8779
private function formatStringDate(string $value, ?DateTimeZone $timezone): string
8880
{

0 commit comments

Comments
 (0)