diff --git a/src/AbstractDateTime.php b/src/AbstractDateTime.php index 0b617ff..2fc3515 100644 --- a/src/AbstractDateTime.php +++ b/src/AbstractDateTime.php @@ -34,8 +34,6 @@ public function __toString(): string } /** - * @param \DateTimeInterface $dateTime - * * @return static */ public static function createFromDateTime(\DateTimeInterface $dateTime): self @@ -50,8 +48,6 @@ public static function createFromDateTime(\DateTimeInterface $dateTime): self } /** - * @param int $timestamp - * * @return static */ public static function createFromTimestamp(int $timestamp): self @@ -62,13 +58,12 @@ public static function createFromTimestamp(int $timestamp): self } /** - * @param string $format - * @param string $dateTime - * @param \DateTimeZone $timezone + * @param string $format + * @param string $dateTime * * @return static */ - public static function createFromFormat($format, $dateTime, $timezone = null): self + public static function createFromFormat($format, $dateTime, \DateTimeZone $timezone = null): self { $class = static::getClass(); @@ -139,21 +134,33 @@ public function getWeekday(): int return (int) $this->format('w'); } + /** + * @return static + */ public function addYears(int $years): DateTimeInterface { return $this->modify($years.' years'); } + /** + * @return static + */ public function addMonths(int $months): DateTimeInterface { return $this->modify($months.' months'); } + /** + * @return static + */ public function addWeeks(int $weeks): DateTimeInterface { return $this->modify($weeks.' weeks'); } + /** + * @return static + */ public function addDays(int $days): DateTimeInterface { return $this->modify($days.' days'); diff --git a/src/DateTimeInterface.php b/src/DateTimeInterface.php index d4ac778..5bb2e23 100644 --- a/src/DateTimeInterface.php +++ b/src/DateTimeInterface.php @@ -15,80 +15,40 @@ interface DateTimeInterface extends \DateTimeInterface { - /** - * @return string - */ public function __toString(): string; - /** - * @return string - */ public function formatIso(): string; - /** - * @param string $format - * - * @return string - */ public function formatLocalized(string $format): string; - /** - * @param int $format - * @param int $timeFormat - * - * @return string - */ public function formatIntl(int $format = null, int $timeFormat = null): string; - /** - * @return \DateTime - */ public function toMutable(): \DateTime; - /** - * @return int - */ public function getYear(): int; - /** - * @return int - */ public function getMonth(): int; - /** - * @return int - */ public function getDay(): int; - /** - * @return int - */ public function getWeekday(): int; /** - * @param int $years - * * @return static */ public function addYears(int $years): self; /** - * @param int $months - * * @return static */ public function addMonths(int $months): self; /** - * @param int $weeks - * * @return static */ public function addWeeks(int $weeks): self; /** - * @param int $days - * * @return static */ public function addDays(int $days): self; @@ -171,7 +131,10 @@ public function setDate($year, $month, $day); public function setISODate($year, $week, $day = 1); /** - * @param \DateInterval $interval + * @param int $hour + * @param int $minute + * @param int $second + * @param int $microseconds * * @return static */ diff --git a/src/Holidays/HolidaysInterface.php b/src/Holidays/HolidaysInterface.php index 12e27d0..68737cd 100644 --- a/src/Holidays/HolidaysInterface.php +++ b/src/Holidays/HolidaysInterface.php @@ -16,23 +16,11 @@ interface HolidaysInterface { - /** - * @param DateTimeInterface $dateTime - * - * @return bool - */ public function isHoliday(DateTimeInterface $dateTime): bool; - /** - * @param DateTimeInterface $dateTime - * - * @return bool - */ public function isWorkday(DateTimeInterface $dateTime): bool; /** - * @param int|string $year - * * @return Date[] */ public function getHolidays(int $year): array; diff --git a/src/Range/AbstractDateTimeRange.php b/src/Range/AbstractDateTimeRange.php index 7baa8de..6998adf 100644 --- a/src/Range/AbstractDateTimeRange.php +++ b/src/Range/AbstractDateTimeRange.php @@ -43,7 +43,7 @@ public function diff(): \DateInterval return $this->start->diff($this->end); } - public function diffWorkdays(HolidaysInterface $holidays = null): int + public function diffWorkdays(?HolidaysInterface $holidays = null): int { return $this->start->diffWorkdays($this->end, $holidays); } diff --git a/src/Range/DateTimeRangeInterface.php b/src/Range/DateTimeRangeInterface.php index a1915e7..ce1cc5d 100644 --- a/src/Range/DateTimeRangeInterface.php +++ b/src/Range/DateTimeRangeInterface.php @@ -16,62 +16,25 @@ interface DateTimeRangeInterface { - /** - * @return DateTimeInterface - */ public function getStart(): DateTimeInterface; - /** - * @return DateTimeInterface - */ public function getEnd(): DateTimeInterface; - /** - * @return \DateInterval - */ public function diff(): \DateInterval; - /** - * @param null|HolidaysInterface $holidays - * - * @return int - */ - public function diffWorkdays(HolidaysInterface $holidays = null): int; + public function diffWorkdays(?HolidaysInterface $holidays = null): int; - /** - * @return bool - */ public function isSameYear(): bool; - /** - * @return bool - */ public function isSameMonth(): bool; - /** - * @return bool - */ public function isSameDay(): bool; - /** - * @return bool - */ public function isWholeYear(): bool; - /** - * @return bool - */ public function isWholeMonth(): bool; - /** - * @return bool - */ public function isWholeDay(): bool; - /** - * @param DateTimeInterface $dateTime - * - * @return bool - */ public function contains(DateTimeInterface $dateTime): bool; }