Skip to content

Commit

Permalink
Merge pull request #8337 from kenjis/docs-Time-properties
Browse files Browse the repository at this point in the history
docs: add @Property to Time
  • Loading branch information
kenjis authored Dec 19, 2023
2 parents 521cc98 + c39961a commit f69a39b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
18 changes: 17 additions & 1 deletion system/I18n/Time.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,23 @@
*
* 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 bool $local 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
Expand Down
17 changes: 16 additions & 1 deletion system/I18n/TimeLegacy.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,22 @@
* 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 bool $local 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
Expand Down
2 changes: 2 additions & 0 deletions system/I18n/TimeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit f69a39b

Please sign in to comment.