From 0a24c22f23af453a6d8f33c27e51b72eceb1e57e Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 16 Dec 2023 10:03:46 +0900 Subject: [PATCH 1/2] docs: add @property to Time --- system/I18n/Time.php | 17 ++++++++++++++++- system/I18n/TimeLegacy.php | 16 +++++++++++++++- system/I18n/TimeTrait.php | 2 ++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/system/I18n/Time.php b/system/I18n/Time.php index 520f38eb90d1..9097dcacdb12 100644 --- a/system/I18n/Time.php +++ b/system/I18n/Time.php @@ -19,7 +19,22 @@ * * Requires the intl PHP extension. * - * @property string $date + * @property int $age read-only + * @property string $day read-only + * @property string $dayOfWeek read-only + * @property string $dayOfYear read-only + * @property bool $dst read-only + * @property string $hour read-only + * @property string $minute read-only + * @property string $month read-only + * @property string $quarter read-only + * @property string $second read-only + * @property int $timestamp read-only + * @property bool $utc read-only + * @property string $weekOfMonth read-only + * @property string $weekOfYear read-only + * @property string $year read-only + * * @see \CodeIgniter\I18n\TimeTest */ class Time extends DateTimeImmutable diff --git a/system/I18n/TimeLegacy.php b/system/I18n/TimeLegacy.php index 7be9f80fac20..adc35bf51d10 100644 --- a/system/I18n/TimeLegacy.php +++ b/system/I18n/TimeLegacy.php @@ -20,7 +20,21 @@ * This is not immutable! Some methods are immutable, * but some methods can alter the state. * - * @property string $date + * @property int $age read-only + * @property string $day read-only + * @property string $dayOfWeek read-only + * @property string $dayOfYear read-only + * @property bool $dst read-only + * @property string $hour read-only + * @property string $minute read-only + * @property string $month read-only + * @property string $quarter read-only + * @property string $second read-only + * @property int $timestamp read-only + * @property bool $utc read-only + * @property string $weekOfMonth read-only + * @property string $weekOfYear read-only + * @property string $year read-only * * @deprecated Use Time instead. * @see \CodeIgniter\I18n\TimeLegacyTest diff --git a/system/I18n/TimeTrait.php b/system/I18n/TimeTrait.php index 7f2068b7a30c..da2bf046517b 100644 --- a/system/I18n/TimeTrait.php +++ b/system/I18n/TimeTrait.php @@ -1182,6 +1182,8 @@ public function __wakeup(): void $timezone = $this->timezone; $this->timezone = new DateTimeZone($timezone); + + // @phpstan-ignore-next-line `$this->date` is a special property for PHP internal use. parent::__construct($this->date, $this->timezone); } } From c39961a44631897b12adbffe598425e97a4ad796 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 16 Dec 2023 10:44:13 +0900 Subject: [PATCH 2/2] docs: add @property $local --- system/I18n/Time.php | 1 + system/I18n/TimeLegacy.php | 1 + 2 files changed, 2 insertions(+) diff --git a/system/I18n/Time.php b/system/I18n/Time.php index 9097dcacdb12..f01718aac6e0 100644 --- a/system/I18n/Time.php +++ b/system/I18n/Time.php @@ -25,6 +25,7 @@ * @property string $dayOfYear read-only * @property bool $dst read-only * @property string $hour read-only + * @property bool $local read-only * @property string $minute read-only * @property string $month read-only * @property string $quarter read-only diff --git a/system/I18n/TimeLegacy.php b/system/I18n/TimeLegacy.php index adc35bf51d10..35523e322475 100644 --- a/system/I18n/TimeLegacy.php +++ b/system/I18n/TimeLegacy.php @@ -26,6 +26,7 @@ * @property string $dayOfYear read-only * @property bool $dst read-only * @property string $hour read-only + * @property bool $local read-only * @property string $minute read-only * @property string $month read-only * @property string $quarter read-only