Skip to content

Commit ce4525d

Browse files
Fix psalm errors
1 parent 9ac39d1 commit ce4525d

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/Timezones/TimezoneTransitionsResolver.php

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,20 @@ public function getTransitions(): array
3838
$this->end->getTimestamp(),
3939
);
4040

41-
// for timezone '+00:00' DateTimeZone::getTransitions() returns boolean false,
42-
// so check for that first and create the fake entry to make it work
4341
if ($transitions === false) {
44-
$transitions = [[
45-
'isdst' => false,
46-
'offset' => 0,
47-
'ts' => $this->start->getTimestamp(),
48-
'abbr' => 'UTC',
49-
]];
50-
} elseif (count($transitions) === 1) {
42+
// for timezone '+00:00' DateTimeZone::getTransitions() returns boolean false,
43+
// so check for that first and create the fake entry to make it work
44+
$transitions = [
45+
[
46+
'isdst' => false,
47+
'offset' => 0,
48+
'ts' => $this->start->getTimestamp(),
49+
'abbr' => 'UTC',
50+
],
51+
];
52+
}
53+
54+
if (count($transitions) === 1) {
5155
// Add a fake transition for UTC for example which does not have transitions
5256
$transitions[] = [
5357
'isdst' => $transitions[0]["isdst"],
@@ -68,8 +72,8 @@ public function getTransitions(): array
6872
? TimezoneEntryType::daylight()
6973
: TimezoneEntryType::standard();
7074

71-
$offsetFrom = $this->resolveOffset((int) $previousTransition['offset']);
72-
$offsetTo = $this->resolveOffset((int) $transition['offset']);
75+
$offsetFrom = $this->resolveOffset($previousTransition['offset']);
76+
$offsetTo = $this->resolveOffset($transition['offset']);
7377

7478
$offsetDiff = $this->resolveOffsetDiff($offsetFrom, $offsetTo);
7579

0 commit comments

Comments
 (0)