Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions system/I18n/TimeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']));
}
}
2 changes: 1 addition & 1 deletion utils/phpstan-baseline/loader.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 2122 errors
# total 2126 errors

includes:
- argument.type.neon
Expand Down
22 changes: 21 additions & 1 deletion utils/phpstan-baseline/method.childParameterType.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 8 errors
# total 12 errors

parameters:
ignoreErrors:
Expand Down Expand Up @@ -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
Loading