From 76ae6f6a2eb05a4e095385e625b7f498f199e6cd Mon Sep 17 00:00:00 2001 From: Eric Wright Date: Wed, 10 Apr 2024 11:03:25 -0400 Subject: [PATCH] MAGE-866: commit cherry-picked from 864 --- ViewModel/Adminhtml/Analytics/Overview.php | 23 ++++++++++------------ composer.json | 1 + 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/ViewModel/Adminhtml/Analytics/Overview.php b/ViewModel/Adminhtml/Analytics/Overview.php index 0865b4bb1..7ccc91a39 100644 --- a/ViewModel/Adminhtml/Analytics/Overview.php +++ b/ViewModel/Adminhtml/Analytics/Overview.php @@ -7,6 +7,7 @@ use Algolia\AlgoliaSearch\ViewModel\Adminhtml\BackendView; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Locale\ResolverInterface; use Magento\Store\Api\Data\StoreInterface; class Overview implements \Magento\Framework\View\Element\Block\ArgumentInterface @@ -17,15 +18,6 @@ class Overview implements \Magento\Framework\View\Element\Block\ArgumentInterfac public const DEFAULT_RETENTION_DAYS = 90; - /** @var BackendView */ - private $backendView; - - /** @var AnalyticsHelper */ - private $analyticsHelper; - - /** @var IndexEntityDataProvider */ - private $indexEntityDataProvider; - /** @var array */ private $analyticsParams = []; @@ -33,6 +25,7 @@ class Overview implements \Magento\Framework\View\Element\Block\ArgumentInterfac * @param BackendView $backendView * @param AnalyticsHelper $analyticsHelper * @param IndexEntityDataProvider $indexEntityDataProvider + * @param ResolverInterface $localeResolver */ public function __construct( protected BackendView $backendView, @@ -49,9 +42,13 @@ public function getBackendView() return $this->backendView; } - public function getTimeZone() + /** + * @return string + * @throws NoSuchEntityException + */ + public function getTimeZone(): string { - return $this->backendView->getDateTime()->getConfigTimezone( + return (string) $this->backendView->getDateTime()->getConfigTimezone( \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->getStore()->getId() ); @@ -76,7 +73,7 @@ public function getIndexName() * * @return array */ - public function getAnalyticsParams($additional = []) + public function getAnalyticsParams(array $additional = []): array { if (empty($this->analyticsParams)) { $params = ['index' => $this->getIndexName()]; @@ -332,7 +329,7 @@ public function getNoResultSearches() * * @return bool */ - public function checkIsValidDateRange() + public function checkIsValidDateRange(): bool { if ($formData = $this->getBackendView()->getBackendSession()->getAlgoliaAnalyticsFormData()) { if (!empty($formData['from'])) { diff --git a/composer.json b/composer.json index bc18202ab..7d77e5827 100755 --- a/composer.json +++ b/composer.json @@ -5,6 +5,7 @@ "license": ["MIT"], "version": "3.13.2", "require": { + "php": "~8.1|~8.2", "magento/framework": "~102.0|~103.0", "algolia/algoliasearch-client-php": "3.3.2", "guzzlehttp/guzzle": "^6.3.3|^7.3.0",