diff --git a/system/I18n/TimeTrait.php b/system/I18n/TimeTrait.php index d9abb16e29a2..e8c3472d63c0 100644 --- a/system/I18n/TimeTrait.php +++ b/system/I18n/TimeTrait.php @@ -1238,19 +1238,11 @@ public function __isset($name): bool /** * This is called when we unserialize the Time object. + * + * @param array{date: string, timezone: string, timezone_type: int} $data */ - public function __wakeup(): void + public function __unserialize(array $data): void { - /** - * Prior to unserialization, this is a string. - * - * @var string $timezone - */ - $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); + parent::__construct($data['date'], new DateTimeZone($data['timezone'])); } } diff --git a/utils/phpstan-baseline/loader.neon b/utils/phpstan-baseline/loader.neon index 7c302e27351d..7378ca423744 100644 --- a/utils/phpstan-baseline/loader.neon +++ b/utils/phpstan-baseline/loader.neon @@ -1,4 +1,4 @@ -# total 2122 errors +# total 2126 errors includes: - argument.type.neon diff --git a/utils/phpstan-baseline/method.childParameterType.neon b/utils/phpstan-baseline/method.childParameterType.neon index d6446dcbb7bd..d5b6014b15a6 100644 --- a/utils/phpstan-baseline/method.childParameterType.neon +++ b/utils/phpstan-baseline/method.childParameterType.neon @@ -1,4 +1,4 @@ -# total 8 errors +# total 12 errors parameters: ignoreErrors: @@ -41,3 +41,23 @@ parameters: message: '#^Parameter \#1 \$value \(int\) of method CodeIgniter\\Entity\\Cast\\IntBoolCast\:\:get\(\) should be contravariant with parameter \$value \(array\|bool\|float\|int\|object\|string\|null\) of method CodeIgniter\\Entity\\Cast\\CastInterface\:\:get\(\)$#' count: 1 path: ../../system/Entity/Cast/IntBoolCast.php + + - + message: '#^Parameter \#1 \$data \(array\{date\: string, timezone\: string, timezone_type\: int\}\) of method CodeIgniter\\I18n\\Time\:\:__unserialize\(\) should be contravariant with parameter \$data \(array\) of method DateTimeImmutable\:\:__unserialize\(\)$#' + count: 1 + path: ../../system/I18n/Time.php + + - + message: '#^Parameter \#1 \$data \(array\{date\: string, timezone\: string, timezone_type\: int\}\) of method CodeIgniter\\I18n\\Time\:\:__unserialize\(\) should be contravariant with parameter \$data \(array\) of method DateTimeInterface\:\:__unserialize\(\)$#' + count: 1 + path: ../../system/I18n/Time.php + + - + message: '#^Parameter \#1 \$data \(array\{date\: string, timezone\: string, timezone_type\: int\}\) of method CodeIgniter\\I18n\\TimeLegacy\:\:__unserialize\(\) should be contravariant with parameter \$data \(array\) of method DateTimeInterface\:\:__unserialize\(\)$#' + count: 1 + path: ../../system/I18n/TimeLegacy.php + + - + message: '#^Parameter \#1 \$data \(array\{date\: string, timezone\: string, timezone_type\: int\}\) of method CodeIgniter\\I18n\\TimeLegacy\:\:__unserialize\(\) should be contravariant with parameter \$data \(array\) of method DateTime\:\:__unserialize\(\)$#' + count: 1 + path: ../../system/I18n/TimeLegacy.php