Skip to content

Commit a37bbd6

Browse files
michalsnneznaika0
andcommitted
early return
Co-authored-by: neznaika0 <ozornick.ks@gmail.com>
1 parent b3d10cf commit a37bbd6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

system/I18n/TimeTrait.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,16 +1212,16 @@ public function getUTCObject($time, ?string $timezone = null)
12121212
*/
12131213
private function normalizeTime($time, ?string $timezone = null): static
12141214
{
1215+
if ($time instanceof DateTimeInterface) {
1216+
return static::createFromInstance($time, $this->locale);
1217+
}
1218+
12151219
$timezone = in_array($timezone, [null, '', '0'], true) ? $this->timezone : $timezone;
12161220

12171221
if ($time === null) {
12181222
return static::now($timezone, $this->locale);
12191223
}
12201224

1221-
if ($time instanceof DateTimeInterface) {
1222-
return static::createFromInstance($time, $this->locale);
1223-
}
1224-
12251225
return new static($time, $timezone, $this->locale);
12261226
}
12271227

0 commit comments

Comments
 (0)