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

View File

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