mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-14 07:28:41 +00:00
fix DateTime -> DateTimeImmutable
This commit is contained in:
parent
80dee41e9e
commit
0a11f2d36b
|
|
@ -250,9 +250,6 @@ final class L11nManager
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @todo Orange-Management/phpOMS#247
|
|
||||||
* [L11nManager] Create currency rendering test for million and billion dividers
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function getCurrency(Localization $l11n, $currency, string $format = null, string $symbol = null, int $divide = 1) : string
|
public function getCurrency(Localization $l11n, $currency, string $format = null, string $symbol = null, int $divide = 1) : string
|
||||||
|
|
@ -276,15 +273,15 @@ final class L11nManager
|
||||||
/**
|
/**
|
||||||
* Print a datetime
|
* Print a datetime
|
||||||
*
|
*
|
||||||
* @param Localization $l11n Localization
|
* @param Localization $l11n Localization
|
||||||
* @param null|\DateTime $datetime DateTime to print
|
* @param null|\DateTimeInterface $datetime DateTime to print
|
||||||
* @param string $format Format type to use
|
* @param string $format Format type to use
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function getDateTime(Localization $l11n, \DateTime $datetime = null, string $format = null) : string
|
public function getDateTime(Localization $l11n, \DateTimeInterface $datetime = null, string $format = null) : string
|
||||||
{
|
{
|
||||||
return $datetime === null ? '' : $datetime->format($l11n->getDateTime()[$format ?? 'medium']);
|
return $datetime === null ? '' : $datetime->format($l11n->getDateTime()[$format ?? 'medium']);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ declare(strict_types=1);
|
||||||
namespace phpOMS\Utils\Converter;
|
namespace phpOMS\Utils\Converter;
|
||||||
|
|
||||||
use phpOMS\Stdlib\Base\Enum;
|
use phpOMS\Stdlib\Base\Enum;
|
||||||
use phpOMS\Utils\Converter\Measurement;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File size type enum.
|
* File size type enum.
|
||||||
|
|
@ -61,11 +60,11 @@ abstract class FileSizeType extends Enum
|
||||||
if ($size < 300) {
|
if ($size < 300) {
|
||||||
return [$size, 'B'];
|
return [$size, 'B'];
|
||||||
} elseif ($size < 1000) {
|
} elseif ($size < 1000) {
|
||||||
return [Measurement::convertFileSize($size, FileSizeType::BYTE, FileSizeType::KILOBYTE), 'KB'];
|
return [Measurement::convertFileSize($size, self::BYTE, self::KILOBYTE), 'KB'];
|
||||||
} elseif ($size < 1000 * 1000 * 1000) {
|
} elseif ($size < 1000 * 1000 * 1000) {
|
||||||
return [Measurement::convertFileSize($size, FileSizeType::BYTE, FileSizeType::MEGABYTE), 'MB'];
|
return [Measurement::convertFileSize($size, self::BYTE, self::MEGABYTE), 'MB'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return [Measurement::convertFileSize($size, FileSizeType::BYTE, FileSizeType::GIGABYTE), 'GB'];
|
return [Measurement::convertFileSize($size, self::BYTE, self::GIGABYTE), 'GB'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -344,14 +344,14 @@ class View extends ViewAbstract
|
||||||
/**
|
/**
|
||||||
* Print a datetime
|
* Print a datetime
|
||||||
*
|
*
|
||||||
* @param null|\DateTime $datetime DateTime to print
|
* @param null|\DateTimeInterface $datetime DateTime to print
|
||||||
* @param string $format Format type to use
|
* @param string $format Format type to use
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function getDateTime(\DateTime $datetime = null, string $format = null) : string
|
public function getDateTime(\DateTimeInterface $datetime = null, string $format = null) : string
|
||||||
{
|
{
|
||||||
return $this->l11nManager->getDateTime($this->l11n, $datetime, $format);
|
return $this->l11nManager->getDateTime($this->l11n, $datetime, $format);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user