Skip to content
Snippets Groups Projects
Commit 144bcdd3 authored by Daniel Kurowski's avatar Daniel Kurowski
Browse files

fix phpstan - array shape for states

parent a620ef11
No related branches found
No related tags found
1 merge request!26Upgrade deps and ci image
......@@ -49,6 +49,7 @@ final class BrickDateTimeIntegration
},
static function (State $state): Instant {
$state->ensureVersion(1);
/** @var array{timestamp: string} $state */
$local = LocalDateTime::parse($state['timestamp'], IsoParsers::offsetDateTime());
return $local->atTimeZone(TimeZone::utc())->getInstant();
},
......@@ -62,6 +63,7 @@ final class BrickDateTimeIntegration
},
static function (State $state): LocalDate {
$state->ensureVersion(1);
/** @var array{date: string} $state */
return LocalDate::parse($state['date']);
},
......@@ -74,6 +76,7 @@ final class BrickDateTimeIntegration
},
static function (State $state): LocalTime {
$state->ensureVersion(1);
/** @var array{time: string} $state */
return LocalTime::parse($state['time']);
},
......@@ -86,6 +89,7 @@ final class BrickDateTimeIntegration
},
static function (State $state): LocalDateTime {
$state->ensureVersion(1);
/** @var array{datetime: string} $state */
return LocalDateTime::parse($state['datetime']);
},
......@@ -98,6 +102,7 @@ final class BrickDateTimeIntegration
},
static function (State $state): ZonedDateTime {
$state->ensureVersion(1);
/** @var array{dateTimeWithZone: string} $state */
return ZonedDateTime::parse($state['dateTimeWithZone']);
},
......@@ -115,6 +120,7 @@ final class BrickDateTimeIntegration
/** @matchSubtypes*/
static function (State $state): TimeZone {
$state->ensureVersion(1);
/** @var array{id: string} $state */
$instance = TimeZone::parse($state['id']);
// make sure that what we have serialized, we are also deserializing
......@@ -134,6 +140,7 @@ final class BrickDateTimeIntegration
},
static function (State $state): Duration {
$state->ensureVersion(1);
/** @var array{duration: string} $state */
return Duration::parse($state['duration']);
},
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment