From 4f16bbe5f551a900711debb31f7097fd3baeb100 Mon Sep 17 00:00:00 2001 From: Art4 Date: Wed, 6 Nov 2024 07:52:46 +0000 Subject: [PATCH] deprecate App::ge DI::app(),tTimeZone() and App::setTimezone() --- src/App.php | 11 ++++++----- src/DI.php | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/App.php b/src/App.php index 5bc9b68755..25a57984ea 100644 --- a/src/App.php +++ b/src/App.php @@ -172,23 +172,24 @@ class App /** * Set the timezone * + * @deprecated 2024.12 Use AppHelper::setTimeZone() instead + * * @param string $timezone A valid time zone identifier, see https://www.php.net/manual/en/timezones.php * @return void */ public function setTimeZone(string $timezone) { - $this->timezone = (new \DateTimeZone($timezone))->getName(); - DateTimeFormat::setLocalTimeZone($this->timezone); + DI::apphelper()->setTimeZone($timezone); } /** * Get the timezone * - * @return int + * @deprecated 2024.12 Use AppHelper::getTimeZone() instead */ public function getTimeZone(): string { - return $this->timezone; + return DI::apphelper()->getTimeZone(); } /** @@ -364,7 +365,7 @@ class App $timezone = $default_timezone ?? '' ?: 'UTC'; } - $this->setTimeZone($timezone); + DI::apphelper()->setTimeZone($timezone); } /** diff --git a/src/DI.php b/src/DI.php index 2c36c9c190..8f5c9859e5 100644 --- a/src/DI.php +++ b/src/DI.php @@ -71,6 +71,8 @@ abstract class DI // /** + * @deprecated 2024.12 use DI::apphelper() instead + * * @return App */ public static function app()