Skip to content

Commit dad8309

Browse files
committed
fix: switch from static to class
1 parent 11fc4a4 commit dad8309

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Date.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function now(): string
3939
* @param string|null $userTimeZone The timezone to initialize with
4040
* @return Date
4141
*/
42-
public function tick($userDate = 'now', ?string $userTimeZone = null): static
42+
public function tick($userDate = 'now', ?string $userTimeZone = null): Date
4343
{
4444
if ($userDate instanceof DateTime) {
4545
$this->date = $userDate;
@@ -62,7 +62,7 @@ public function tick($userDate = 'now', ?string $userTimeZone = null): static
6262
* @throws \Exception Invalid timezone selection
6363
* @return Date
6464
*/
65-
public function setTimezone(string $timezone = 'Africa/Accra'): static
65+
public function setTimezone(string $timezone = 'Africa/Accra'): Date
6666
{
6767
if (!$timezone = new \DateTimeZone($timezone)) {
6868
throw new \Exception('Invalid timezone selection');
@@ -79,7 +79,7 @@ public function setTimezone(string $timezone = 'Africa/Accra'): static
7979
* @param string|null The interval to add
8080
* @return Date
8181
*/
82-
public function add($duration, ?string $interval = null): static
82+
public function add($duration, ?string $interval = null): Date
8383
{
8484
$this->date->modify($interval ? "$duration $interval" : $duration);
8585

@@ -92,7 +92,7 @@ public function add($duration, ?string $interval = null): static
9292
* @param string|null The interval to subtract
9393
* @return Date
9494
*/
95-
public function subtract($duration, ?string $interval = null): static
95+
public function subtract($duration, ?string $interval = null): Date
9696
{
9797
return $this->add($interval ? "-$duration $interval" : "-$duration");
9898
}
@@ -103,7 +103,7 @@ public function subtract($duration, ?string $interval = null): static
103103
* @return Date
104104
* @throws \Exception Invalid time unit
105105
*/
106-
public function startOf(string $unit): static
106+
public function startOf(string $unit): Date
107107
{
108108
$units = [
109109
'year' => 'Y-01-01 00:00:00',
@@ -131,7 +131,7 @@ public function startOf(string $unit): static
131131
* @return Date
132132
* @throws \Exception Invalid time unit
133133
*/
134-
public function endOf(string $unit): static
134+
public function endOf(string $unit): Date
135135
{
136136
$units = [
137137
'year' => 'Y-12-31 23:59:59',
@@ -160,7 +160,7 @@ public function endOf(string $unit): static
160160
* @return Date
161161
* @throws \Exception Invalid time unit
162162
*/
163-
public function set(string $unit, int $value): static
163+
public function set(string $unit, int $value): Date
164164
{
165165
if ($unit === 'date' || $unit === 'month' || $unit === 'year') {
166166
$this->date->setDate(

0 commit comments

Comments
 (0)