Skip to content

Commit

Permalink
Update psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Oct 7, 2022
1 parent ad0f846 commit fb33af5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Type/DateTimeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,15 +328,15 @@ public function marshal($value): ?DateTimeInterface
return $value->setTimezone($this->defaultTimezone);
}

/** @var class-string<\DatetimeInterface> $class */
/** @var class-string<\DateTimeInterface> $class */
$class = $this->_className;
try {
if ($value === '' || $value === null || is_bool($value)) {
return null;
}

if (is_int($value) || (is_string($value) && ctype_digit($value))) {
/** @var \Datetime|\DateTimeImmutable $dateTime */
/** @var \DateTime|\DateTimeImmutable $dateTime */
$dateTime = new $class('@' . $value);

return $dateTime->setTimezone($this->defaultTimezone);
Expand All @@ -349,7 +349,7 @@ public function marshal($value): ?DateTimeInterface
$dateTime = $this->_parseValue($value);
}

/** @var \Datetime|\DateTimeImmutable $dateTime */
/** @var \DateTime|\DateTimeImmutable $dateTime */
if ($dateTime !== null) {
$dateTime = $dateTime->setTimezone($this->defaultTimezone);
}
Expand Down Expand Up @@ -392,7 +392,7 @@ public function marshal($value): ?DateTimeInterface
$value['microsecond']
);

/** @var \Datetime|\DateTimeImmutable $dateTime */
/** @var \DateTime|\DateTimeImmutable $dateTime */
$dateTime = new $class($format, $value['timezone'] ?? $this->userTimezone);

return $dateTime->setTimezone($this->defaultTimezone);
Expand Down

0 comments on commit fb33af5

Please sign in to comment.