DateFormatter: Fix `Variable '$formatted' is probably undefined`

This commit is contained in:
Sukhwinder Dhillon 2023-08-16 09:26:41 +02:00 committed by raviks789
parent dbc8579747
commit 6baf3bc80a
1 changed files with 6 additions and 0 deletions

View File

@ -159,6 +159,8 @@ class DateFormatter
if ($timeOnly) {
return $ago;
}
$formatted = null;
switch ($type) {
case static::DATE:
// Move to next case
@ -196,6 +198,8 @@ class DateFormatter
if ($timeOnly) {
return $since;
}
$formatted = null;
switch ($type) {
case static::RELATIVE:
$formatted = sprintf(
@ -235,6 +239,8 @@ class DateFormatter
if ($timeOnly) {
return $until;
}
$formatted = null;
switch ($type) {
case static::DATE:
// Move to next case