diff --git a/src/Field/WeekOfYear.php b/src/Field/WeekOfYear.php index 2d115ef..e2ef605 100644 --- a/src/Field/WeekOfYear.php +++ b/src/Field/WeekOfYear.php @@ -7,6 +7,7 @@ use Brick\DateTime\DateTimeException; use Brick\DateTime\DayOfWeek; use Brick\DateTime\LocalDate; +use Brick\DateTime\Month; /** * The week-of-year field. @@ -51,7 +52,7 @@ public static function check(int $weekOfYear, ?int $year = null): void */ public static function is53WeekYear(int $year): bool { - $date = LocalDate::of($year, 1, 1); + $date = LocalDate::of($year, Month::JANUARY, 1); $dayOfWeek = $date->getDayOfWeek(); return $dayOfWeek === DayOfWeek::THURSDAY diff --git a/src/LocalDate.php b/src/LocalDate.php index e8cc497..a267b7a 100644 --- a/src/LocalDate.php +++ b/src/LocalDate.php @@ -111,7 +111,7 @@ public static function ofYearDay(int $year, int $dayOfYear): LocalDate $dayOfMonth = $dayOfYear - $monthOfYear->getFirstDayOfYear($isLeap) + 1; - return LocalDate::of($year, $monthOfYear->value, $dayOfMonth); + return LocalDate::of($year, $monthOfYear, $dayOfMonth); } /** @@ -223,7 +223,7 @@ public static function min(): LocalDate return $min; } - return $min = LocalDate::of(self::MIN_YEAR, 1, 1); + return $min = LocalDate::of(self::MIN_YEAR, Month::JANUARY, 1); } /** @@ -240,7 +240,7 @@ public static function max(): LocalDate return $max; } - return $max = LocalDate::of(self::MAX_YEAR, 12, 31); + return $max = LocalDate::of(self::MAX_YEAR, Month::DECEMBER, 31); } /** diff --git a/src/LocalTime.php b/src/LocalTime.php index 8f5b472..5fdd884 100644 --- a/src/LocalTime.php +++ b/src/LocalTime.php @@ -607,7 +607,7 @@ public function toSecondOfDay(): int */ public function toNativeDateTime(): DateTime { - return $this->atDate(LocalDate::of(0, 1, 1))->toNativeDateTime(); + return $this->atDate(LocalDate::of(0, Month::JANUARY, 1))->toNativeDateTime(); } /** diff --git a/src/Year.php b/src/Year.php index 143ccc9..9fd6c99 100644 --- a/src/Year.php +++ b/src/Year.php @@ -274,8 +274,8 @@ public function atMonthDay(MonthDay $monthDay): LocalDate public function toLocalDateRange(): LocalDateRange { return LocalDateRange::of( - $this->atMonth(1)->getFirstDay(), - $this->atMonth(12)->getLastDay(), + $this->atMonth(Month::JANUARY)->getFirstDay(), + $this->atMonth(Month::DECEMBER)->getLastDay(), ); } diff --git a/src/YearWeek.php b/src/YearWeek.php index 2828606..2e237b3 100644 --- a/src/YearWeek.php +++ b/src/YearWeek.php @@ -206,7 +206,7 @@ public function atDay(DayOfWeek|int $dayOfWeek): LocalDate $dayOfWeek = DayOfWeek::from($dayOfWeek); } - $correction = LocalDate::of($this->year, 1, 4)->getDayOfWeek()->value + 3; + $correction = LocalDate::of($this->year, Month::JANUARY, 4)->getDayOfWeek()->value + 3; $dayOfYear = $this->week * 7 + $dayOfWeek->value - $correction; $maxDaysOfYear = Field\Year::isLeap($this->year) ? 366 : 365;