Skip to content

Commit bf98faa

Browse files
committed
Add @psalm-return -1|0|1 on compareTo methods.
1 parent ce2e9ed commit bf98faa

File tree

10 files changed

+20
-0
lines changed

10 files changed

+20
-0
lines changed

src/Duration.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,8 @@ public function abs(): Duration
466466
* @param Duration $that The other duration to compare to.
467467
*
468468
* @return int [-1,0,1] If this duration is less than, equal to, or greater than the given duration.
469+
*
470+
* @psalm-return -1|0|1
469471
*/
470472
public function compareTo(Duration $that): int
471473
{

src/Instant.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ public function getNano(): int
238238
* Compares this instant with another.
239239
*
240240
* @return int [-1,0,1] If this instant is before, on, or after the given instant.
241+
*
242+
* @psalm-return -1|0|1
241243
*/
242244
public function compareTo(Instant $that): int
243245
{

src/LocalDate.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,8 @@ public function minusDays(int $days): LocalDate
591591
* Returns -1 if this date is before the given date, 1 if after, 0 if the dates are equal.
592592
*
593593
* @return int [-1,0,1] If this date is before, on, or after the given date.
594+
*
595+
* @psalm-return -1|0|1
594596
*/
595597
public function compareTo(LocalDate $that): int
596598
{

src/LocalDateTime.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,8 @@ public function minusNanos(int $nanos): LocalDateTime
659659
* @param LocalDateTime $that The date-time to compare to.
660660
*
661661
* @return int [-1,0,1] If this date-time is before, on, or after the given date-time.
662+
*
663+
* @psalm-return -1|0|1
662664
*/
663665
public function compareTo(LocalDateTime $that): int
664666
{

src/LocalTime.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,8 @@ public function minusNanos(int $nanos): LocalTime
527527
* @param LocalTime $that The time to compare to.
528528
*
529529
* @return int [-1,0,1] If this time is before, on, or after the given time.
530+
*
531+
* @psalm-return -1|0|1
530532
*/
531533
public function compareTo(LocalTime $that): int
532534
{

src/MonthDay.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ public function getDayOfMonth(): int
133133
* Returns -1 if this date is before the given date, 1 if after, 0 if the dates are equal.
134134
*
135135
* @return int [-1,0,1] If this date is before, on, or after the given date.
136+
*
137+
* @psalm-return -1|0|1
136138
*/
137139
public function compareTo(MonthDay $that): int
138140
{

src/Year.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ public function minus(int $years): Year
175175
* @param Year $that The year to compare to.
176176
*
177177
* @return int [-1, 0, 1] If this year is before, equal to, or after the given year.
178+
*
179+
* @psalm-return -1|0|1
178180
*/
179181
public function compareTo(Year $that): int
180182
{

src/YearMonth.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ public function getLengthOfYear(): int
147147

148148
/**
149149
* @return int [-1,0,1] If this year-month is before, on, or after the given year-month.
150+
*
151+
* @psalm-return -1|0|1
150152
*/
151153
public function compareTo(YearMonth $that): int
152154
{

src/YearWeek.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ public function getWeek(): int
106106

107107
/**
108108
* @return int [-1,0,1] If this year-week is before, on, or after the given year-week.
109+
*
110+
* @psalm-return -1|0|1
109111
*/
110112
public function compareTo(YearWeek $that): int
111113
{

src/ZonedDateTime.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,8 @@ public function minusSeconds(int $seconds): ZonedDateTime
611611
* The comparison is performed on the instant.
612612
*
613613
* @return int [-1,0,1] If this zoned date-time is before, on, or after the given one.
614+
*
615+
* @psalm-return -1|0|1
614616
*/
615617
public function compareTo(ZonedDateTime $that): int
616618
{

0 commit comments

Comments
 (0)