diff --git a/src/DayOfWeek.php b/src/DayOfWeek.php index 59af2dd..532df96 100644 --- a/src/DayOfWeek.php +++ b/src/DayOfWeek.php @@ -226,6 +226,8 @@ public function minus(int $days): DayOfWeek /** * Serializes as a string using {@see DayOfWeek::toString()}. + * + * @psalm-return non-empty-string */ public function jsonSerialize(): string { @@ -234,6 +236,8 @@ public function jsonSerialize(): string /** * Returns the capitalized English name of this day-of-week. + * + * @psalm-return non-empty-string */ public function toString(): string { diff --git a/src/Duration.php b/src/Duration.php index 77d3583..c4843ec 100644 --- a/src/Duration.php +++ b/src/Duration.php @@ -466,6 +466,8 @@ public function abs(): Duration * @param Duration $that The other duration to compare to. * * @return int [-1,0,1] If this duration is less than, equal to, or greater than the given duration. + * + * @psalm-return -1|0|1 */ public function compareTo(Duration $that): int { @@ -756,6 +758,8 @@ public function toNanosPart(): int /** * Serializes as a string using {@see Duration::toISOString()}. + * + * @psalm-return non-empty-string */ public function jsonSerialize(): string { @@ -772,6 +776,8 @@ public function jsonSerialize(): string * The hours, minutes and seconds will all have the same sign. * * Note that multiples of 24 hours are not output as days to avoid confusion with Period. + * + * @psalm-return non-empty-string */ public function toISOString(): string { @@ -817,6 +823,8 @@ public function toISOString(): string /** * {@see Duration::toISOString()}. + * + * @psalm-return non-empty-string */ public function __toString(): string { diff --git a/src/Instant.php b/src/Instant.php index 14c17b3..ff97f47 100644 --- a/src/Instant.php +++ b/src/Instant.php @@ -238,6 +238,8 @@ public function getNano(): int * Compares this instant with another. * * @return int [-1,0,1] If this instant is before, on, or after the given instant. + * + * @psalm-return -1|0|1 */ public function compareTo(Instant $that): int { @@ -368,6 +370,8 @@ public function toDecimal(): string /** * Serializes as a string using {@see Instant::toISOString()}. + * + * @psalm-return non-empty-string */ public function jsonSerialize(): string { @@ -376,6 +380,8 @@ public function jsonSerialize(): string /** * Returns the ISO 8601 representation of this instant. + * + * @psalm-return non-empty-string */ public function toISOString(): string { @@ -384,6 +390,8 @@ public function toISOString(): string /** * {@see Instant::toISOString()}. + * + * @psalm-return non-empty-string */ public function __toString(): string { diff --git a/src/Interval.php b/src/Interval.php index d847696..aab657c 100644 --- a/src/Interval.php +++ b/src/Interval.php @@ -140,6 +140,8 @@ public function isEqualTo(Interval $that): bool /** * Serializes as a string using {@see Interval::toISOString()}. + * + * @psalm-return non-empty-string */ public function jsonSerialize(): string { @@ -148,6 +150,8 @@ public function jsonSerialize(): string /** * Returns the ISO 8601 representation of this interval. + * + * @psalm-return non-empty-string */ public function toISOString(): string { @@ -156,6 +160,8 @@ public function toISOString(): string /** * {@see Interval::toISOString()}. + * + * @psalm-return non-empty-string */ public function __toString(): string { diff --git a/src/LocalDate.php b/src/LocalDate.php index 59e4859..9bd3296 100644 --- a/src/LocalDate.php +++ b/src/LocalDate.php @@ -591,6 +591,8 @@ public function minusDays(int $days): LocalDate * Returns -1 if this date is before the given date, 1 if after, 0 if the dates are equal. * * @return int [-1,0,1] If this date is before, on, or after the given date. + * + * @psalm-return -1|0|1 */ public function compareTo(LocalDate $that): int { @@ -771,6 +773,8 @@ public function toNativeDateTimeImmutable(): DateTimeImmutable /** * Serializes as a string using {@see LocalDate::toISOString()}. + * + * @psalm-return non-empty-string */ public function jsonSerialize(): string { @@ -779,6 +783,8 @@ public function jsonSerialize(): string /** * Returns the ISO 8601 representation of this date. + * + * @psalm-return non-empty-string */ public function toISOString(): string { @@ -799,6 +805,8 @@ public function toISOString(): string /** * {@see LocalDate::toISOString()}. + * + * @psalm-return non-empty-string */ public function __toString(): string { diff --git a/src/LocalDateRange.php b/src/LocalDateRange.php index 5c919b8..73409cb 100644 --- a/src/LocalDateRange.php +++ b/src/LocalDateRange.php @@ -239,6 +239,8 @@ public function count(): int /** * Serializes as a string using {@see LocalDateRange::toISOString()}. + * + * @psalm-return non-empty-string */ public function jsonSerialize(): string { @@ -262,6 +264,8 @@ public function toNativeDatePeriod(): DatePeriod /** * Returns the ISO 8601 representation of this date range. + * + * @psalm-return non-empty-string */ public function toISOString(): string { @@ -270,6 +274,8 @@ public function toISOString(): string /** * {@see LocalDateRange::toISOString()}. + * + * @psalm-return non-empty-string */ public function __toString(): string { diff --git a/src/LocalDateTime.php b/src/LocalDateTime.php index 6da9d61..11c9395 100644 --- a/src/LocalDateTime.php +++ b/src/LocalDateTime.php @@ -659,6 +659,8 @@ public function minusNanos(int $nanos): LocalDateTime * @param LocalDateTime $that The date-time to compare to. * * @return int [-1,0,1] If this date-time is before, on, or after the given date-time. + * + * @psalm-return -1|0|1 */ public function compareTo(LocalDateTime $that): int { @@ -738,6 +740,8 @@ public function toNativeDateTimeImmutable(): DateTimeImmutable /** * Serializes as a string using {@see LocalDateTime::toISOString()}. + * + * @psalm-return non-empty-string */ public function jsonSerialize(): string { @@ -746,6 +750,8 @@ public function jsonSerialize(): string /** * Returns the ISO 8601 representation of this date time. + * + * @psalm-return non-empty-string */ public function toISOString(): string { @@ -754,6 +760,8 @@ public function toISOString(): string /** * {@see LocalDateTime::toISOString()}. + * + * @psalm-return non-empty-string */ public function __toString(): string { diff --git a/src/LocalTime.php b/src/LocalTime.php index 9ca1e99..8144a80 100644 --- a/src/LocalTime.php +++ b/src/LocalTime.php @@ -527,6 +527,8 @@ public function minusNanos(int $nanos): LocalTime * @param LocalTime $that The time to compare to. * * @return int [-1,0,1] If this time is before, on, or after the given time. + * + * @psalm-return -1|0|1 */ public function compareTo(LocalTime $that): int { @@ -643,6 +645,8 @@ public function toNativeDateTimeImmutable(): DateTimeImmutable /** * Serializes as a string using {@see LocalTime::toISOString()}. + * + * @psalm-return non-empty-string */ public function jsonSerialize(): string { @@ -661,6 +665,8 @@ public function jsonSerialize(): string * The format used will be the shortest that outputs the full value of * the time where the omitted parts are implied to be zero. * The nanoseconds value, if present, can be 0 to 9 digits. + * + * @psalm-return non-empty-string */ public function toISOString(): string { @@ -674,6 +680,8 @@ public function toISOString(): string /** * {@see LocalTime::toISOString()}. + * + * @psalm-return non-empty-string */ public function __toString(): string { diff --git a/src/Month.php b/src/Month.php index f896d5f..b6dd5cc 100644 --- a/src/Month.php +++ b/src/Month.php @@ -201,6 +201,8 @@ public function minus(int $months): Month /** * Serializes as a string using {@see Month::toString()}. + * + * @psalm-return non-empty-string */ public function jsonSerialize(): string { @@ -209,6 +211,8 @@ public function jsonSerialize(): string /** * Returns the capitalized English name of this Month. + * + * @psalm-return non-empty-string */ public function toString(): string { diff --git a/src/MonthDay.php b/src/MonthDay.php index 15912f9..797f83e 100644 --- a/src/MonthDay.php +++ b/src/MonthDay.php @@ -133,6 +133,8 @@ public function getDayOfMonth(): int * Returns -1 if this date is before the given date, 1 if after, 0 if the dates are equal. * * @return int [-1,0,1] If this date is before, on, or after the given date. + * + * @psalm-return -1|0|1 */ public function compareTo(MonthDay $that): int { @@ -243,6 +245,8 @@ public function atYear(int $year): LocalDate /** * Serializes as a string using {@see MonthDay::toISOString()}. + * + * @psalm-return non-empty-string */ public function jsonSerialize(): string { @@ -251,6 +255,8 @@ public function jsonSerialize(): string /** * Returns the ISO 8601 representation of this month-day. + * + * @psalm-return non-empty-string */ public function toISOString(): string { @@ -263,6 +269,8 @@ public function toISOString(): string /** * {@see MonthDay::toISOString()}. + * + * @psalm-return non-empty-string */ public function __toString(): string { diff --git a/src/Period.php b/src/Period.php index 0f1844c..94679be 100644 --- a/src/Period.php +++ b/src/Period.php @@ -379,6 +379,8 @@ public function toNativeDateInterval(): DateInterval /** * Serializes as a string using {@see Period::toISOString()}. + * + * @psalm-return non-empty-string */ public function jsonSerialize(): string { @@ -387,6 +389,8 @@ public function jsonSerialize(): string /** * Returns the ISO 8601 representation of this period. + * + * @psalm-return non-empty-string */ public function toISOString(): string { @@ -411,6 +415,8 @@ public function toISOString(): string /** * {@see Period::toISOString()}. + * + * @psalm-return non-empty-string */ public function __toString(): string { diff --git a/src/TimeZone.php b/src/TimeZone.php index 467f8d0..915e8d2 100644 --- a/src/TimeZone.php +++ b/src/TimeZone.php @@ -93,6 +93,9 @@ public static function fromNativeDateTimeZone(DateTimeZone $dateTimeZone): TimeZ */ abstract public function toNativeDateTimeZone(): DateTimeZone; + /** + * @psalm-return non-empty-string + */ public function __toString(): string { return $this->getId(); diff --git a/src/Year.php b/src/Year.php index 105278d..5dc600c 100644 --- a/src/Year.php +++ b/src/Year.php @@ -178,6 +178,8 @@ public function minus(int $years): Year * @param Year $that The year to compare to. * * @return int [-1, 0, 1] If this year is before, equal to, or after the given year. + * + * @psalm-return -1|0|1 */ public function compareTo(Year $that): int { @@ -284,6 +286,8 @@ public function toLocalDateRange(): LocalDateRange /** * Serializes as a string using {@see Year::toISOString()}. + * + * @psalm-return non-empty-string */ public function jsonSerialize(): string { @@ -292,6 +296,8 @@ public function jsonSerialize(): string /** * Returns the ISO 8601 representation of this year. + * + * @psalm-return non-empty-string */ public function toISOString(): string { @@ -307,6 +313,8 @@ public function toISOString(): string /** * {@see Year::toISOString()}. + * + * @psalm-return non-empty-string */ public function __toString(): string { diff --git a/src/YearMonth.php b/src/YearMonth.php index b30ff4a..43cd211 100644 --- a/src/YearMonth.php +++ b/src/YearMonth.php @@ -147,6 +147,8 @@ public function getLengthOfYear(): int /** * @return int [-1,0,1] If this year-month is before, on, or after the given year-month. + * + * @psalm-return -1|0|1 */ public function compareTo(YearMonth $that): int { @@ -304,6 +306,8 @@ public function toLocalDateRange(): LocalDateRange /** * Serializes as a string using {@see YearMonth::toISOString()}. + * + * @psalm-return non-empty-string */ public function jsonSerialize(): string { @@ -312,6 +316,8 @@ public function jsonSerialize(): string /** * Returns the ISO 8601 representation of this year-month. + * + * @psalm-return non-empty-string */ public function toISOString(): string { @@ -330,6 +336,8 @@ public function toISOString(): string /** * {@see YearMonth::toISOString()}. + * + * @psalm-return non-empty-string */ public function __toString(): string { diff --git a/src/YearMonthRange.php b/src/YearMonthRange.php index 7606c98..55ac86c 100644 --- a/src/YearMonthRange.php +++ b/src/YearMonthRange.php @@ -182,6 +182,8 @@ public function toLocalDateRange(): LocalDateRange /** * Serializes as a string using {@see YearMonthRange::toISOString()}. + * + * @psalm-return non-empty-string */ public function jsonSerialize(): string { @@ -193,6 +195,8 @@ public function jsonSerialize(): string * * ISO 8601 does not seem to provide a standard notation for year-month ranges, but we're using the same format as * date ranges. + * + * @psalm-return non-empty-string */ public function toISOString(): string { @@ -201,6 +205,8 @@ public function toISOString(): string /** * {@see YearMonthRange::toISOString()}. + * + * @psalm-return non-empty-string */ public function __toString(): string { diff --git a/src/YearWeek.php b/src/YearWeek.php index f430775..590a54b 100644 --- a/src/YearWeek.php +++ b/src/YearWeek.php @@ -106,6 +106,8 @@ public function getWeek(): int /** * @return int [-1,0,1] If this year-week is before, on, or after the given year-week. + * + * @psalm-return -1|0|1 */ public function compareTo(YearWeek $that): int { @@ -311,6 +313,8 @@ public function toLocalDateRange(): LocalDateRange /** * Serializes as a string using {@see YearWeek::toISOString()}. + * + * @psalm-return non-empty-string */ public function jsonSerialize(): string { @@ -319,6 +323,8 @@ public function jsonSerialize(): string /** * Returns the ISO 8601 representation of this year-week. + * + * @psalm-return non-empty-string */ public function toISOString(): string { @@ -337,6 +343,8 @@ public function toISOString(): string /** * {@see YearWeek::toISOString()}. + * + * @psalm-return non-empty-string */ public function __toString(): string { diff --git a/src/ZonedDateTime.php b/src/ZonedDateTime.php index 86b9d64..fb625d1 100644 --- a/src/ZonedDateTime.php +++ b/src/ZonedDateTime.php @@ -611,6 +611,8 @@ public function minusSeconds(int $seconds): ZonedDateTime * The comparison is performed on the instant. * * @return int [-1,0,1] If this zoned date-time is before, on, or after the given one. + * + * @psalm-return -1|0|1 */ public function compareTo(ZonedDateTime $that): int { @@ -734,6 +736,8 @@ public function toNativeDateTimeImmutable(): DateTimeImmutable /** * Serializes as a string using {@see ZonedDateTime::toISOString()}. + * + * @psalm-return non-empty-string */ public function jsonSerialize(): string { @@ -742,6 +746,8 @@ public function jsonSerialize(): string /** * Returns the ISO 8601 representation of this zoned date time. + * + * @psalm-return non-empty-string */ public function toISOString(): string { @@ -756,6 +762,8 @@ public function toISOString(): string /** * {@see ZonedDateTime::toISOString()}. + * + * @psalm-return non-empty-string */ public function __toString(): string {