Skip to content

Commit 2c7dc72

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

File tree

10 files changed

+10
-0
lines changed

10 files changed

+10
-0
lines changed

src/Duration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ 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+
* @psalm-return -1|0|1
469470
*/
470471
public function compareTo(Duration $that): int
471472
{

src/Instant.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ 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+
* @psalm-return -1|0|1
241242
*/
242243
public function compareTo(Instant $that): int
243244
{

src/LocalDate.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@ 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+
* @psalm-return -1|0|1
594595
*/
595596
public function compareTo(LocalDate $that): int
596597
{

src/LocalDateTime.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,7 @@ 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+
* @psalm-return -1|0|1
662663
*/
663664
public function compareTo(LocalDateTime $that): int
664665
{

src/LocalTime.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ 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+
* @psalm-return -1|0|1
530531
*/
531532
public function compareTo(LocalTime $that): int
532533
{

src/MonthDay.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ 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+
* @psalm-return -1|0|1
136137
*/
137138
public function compareTo(MonthDay $that): int
138139
{

src/Year.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ 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+
* @psalm-return -1|0|1
178179
*/
179180
public function compareTo(Year $that): int
180181
{

src/YearMonth.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ 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+
* @psalm-return -1|0|1
150151
*/
151152
public function compareTo(YearMonth $that): int
152153
{

src/YearWeek.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ 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+
* @psalm-return -1|0|1
109110
*/
110111
public function compareTo(YearWeek $that): int
111112
{

src/ZonedDateTime.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ 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+
* @psalm-return -1|0|1
614615
*/
615616
public function compareTo(ZonedDateTime $that): int
616617
{

0 commit comments

Comments
 (0)