Skip to content

Commit

Permalink
Remove deprecated getDay() methods
Browse files Browse the repository at this point in the history
Affected classes:

- LocalDate
- LocalDateTime
- MonthDay
- ZonedDateTime
  • Loading branch information
BenMorel committed Jun 22, 2024
1 parent ce462b8 commit 0443cac
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 46 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
- `DefaultClock`:
- deprecated method `travel()` has been removed, use `travelTo()` instead
- `LocalDate`:
- deprecated method `getDay()` has been removed, use `getDayOfMonth()` instead
- `getMonth()` now returns a `Month` enum; use `getMonthValue()` if you want the month number
- `LocalDateTime`:
- deprecated method `getDay()` has been removed, use `getDayOfMonth()` instead
- `getMonth()` now returns a `Month` enum; use `getMonthValue()` if you want the month number
- `Month`:
- deprecated method `of()` has been removed, use `Month::from()` instead
Expand All @@ -30,10 +32,12 @@
- deprecated method `is()` has been removed, compare values with `$month` or `$month->value` instead
- deprecated method `isEqualTo()` has been removed, use strict equality `===` between `Month` instances instead
- `MonthDay`:
- deprecated method `getDay()` has been removed, use `getDayOfMonth()` instead
- `getMonth()` now returns a `Month` enum; use `getMonthValue()` if you want the month number
- `YearMonth`:
- `getMonth()` now returns a `Month` enum; use `getMonthValue()` if you want the month number
- `ZonedDateTime`:
- deprecated method `getDay()` has been removed, use `getDayOfMonth()` instead
- `getMonth()` now returns a `Month` enum; use `getMonthValue()` if you want the month number

## [0.6.5](https://github.com/brick/date-time/releases/tag/0.6.5) - 2024-06-19
Expand Down
8 changes: 0 additions & 8 deletions src/LocalDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,14 +319,6 @@ public function getMonthValue(): int
return $this->month;
}

/**
* @deprecated Use getDayOfMonth() instead.
*/
public function getDay(): int
{
return $this->day;
}

/**
* @return int<1, 31>
*/
Expand Down
8 changes: 0 additions & 8 deletions src/LocalDateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,6 @@ public function getMonthValue(): int
return $this->date->getMonthValue();
}

/**
* @deprecated Use getDayOfMonth() instead.
*/
public function getDay(): int
{
return $this->date->getDayOfMonth();
}

/**
* @return int<1, 31>
*/
Expand Down
8 changes: 0 additions & 8 deletions src/MonthDay.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,6 @@ public function getMonthValue(): int
return $this->month;
}

/**
* @deprecated Use getDayOfMonth() instead.
*/
public function getDay(): int
{
return $this->day;
}

/**
* Returns the day-of-month.
*
Expand Down
8 changes: 0 additions & 8 deletions src/ZonedDateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,6 @@ public function getMonthValue(): int
return $this->localDateTime->getMonthValue();
}

/**
* @deprecated Use getDayOfMonth() instead.
*/
public function getDay(): int
{
return $this->localDateTime->getDayOfMonth();
}

/**
* @return int<1, 31>
*/
Expand Down
9 changes: 0 additions & 9 deletions tests/AbstractTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ protected function assertLocalDateIs(int $year, int $month, int $day, LocalDate
$date->getMonthValue(),
$date->getDayOfMonth(),
]);

// temporary assertions to test the deprecated getters as well
self::assertSame($day, $date->getDay());
}

/**
Expand Down Expand Up @@ -108,9 +105,6 @@ protected function assertLocalDateTimeIs(int $y, int $m, int $d, int $h, int $i,
$dateTime->getSecond(),
$dateTime->getNano(),
]);

// temporary assertions to test the deprecated getters as well
self::assertSame($d, $dateTime->getDay());
}

/**
Expand Down Expand Up @@ -166,9 +160,6 @@ protected function assertMonthDayIs(int $month, int $day, MonthDay $monthDay): v
$monthDay->getMonthValue(),
$monthDay->getDayOfMonth(),
]);

// temporary assertions to test the deprecated getters as well
self::assertSame($day, $monthDay->getDay());
}

/**
Expand Down
5 changes: 0 additions & 5 deletions tests/ZonedDateTimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -549,11 +549,6 @@ public function testGetMonthValue(): void
self::assertSame(1, $this->getTestZonedDateTime()->getMonthValue());
}

public function testGetDay(): void
{
self::assertSame(20, $this->getTestZonedDateTime()->getDay());
}

public function testGetDayOfMonth(): void
{
self::assertSame(20, $this->getTestZonedDateTime()->getDayOfMonth());
Expand Down

0 comments on commit 0443cac

Please sign in to comment.