From e4c9861c6ed88f4b4081d0779af78cd0069fa5a9 Mon Sep 17 00:00:00 2001 From: Vova Yatsyuk Date: Wed, 4 Nov 2020 11:05:54 +0200 Subject: [PATCH] Replace 'static::' with 'self::' when accessing private const. This will prevent 'Undefined class constant' error if a plugin will be added for one of these classes. --- app/code/Magento/Backend/Model/Dashboard/Period.php | 10 +++++----- app/code/Magento/Backend/ViewModel/ChartDisabled.php | 4 ++-- .../Catalog/Model/Config/LayerCategoryConfig.php | 2 +- .../Model/Import/Product/Type/Downloadable.php | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/Backend/Model/Dashboard/Period.php b/app/code/Magento/Backend/Model/Dashboard/Period.php index 28286129e8a68..2dc8c5de1a2d5 100644 --- a/app/code/Magento/Backend/Model/Dashboard/Period.php +++ b/app/code/Magento/Backend/Model/Dashboard/Period.php @@ -46,11 +46,11 @@ public function getDatePeriods(): array public function getPeriodChartUnits(): array { return [ - static::PERIOD_24_HOURS => static::PERIOD_UNIT_HOUR, - static::PERIOD_7_DAYS => static::PERIOD_UNIT_DAY, - static::PERIOD_1_MONTH => static::PERIOD_UNIT_DAY, - static::PERIOD_1_YEAR => static::PERIOD_UNIT_MONTH, - static::PERIOD_2_YEARS => static::PERIOD_UNIT_MONTH + static::PERIOD_24_HOURS => self::PERIOD_UNIT_HOUR, + static::PERIOD_7_DAYS => self::PERIOD_UNIT_DAY, + static::PERIOD_1_MONTH => self::PERIOD_UNIT_DAY, + static::PERIOD_1_YEAR => self::PERIOD_UNIT_MONTH, + static::PERIOD_2_YEARS => self::PERIOD_UNIT_MONTH ]; } } diff --git a/app/code/Magento/Backend/ViewModel/ChartDisabled.php b/app/code/Magento/Backend/ViewModel/ChartDisabled.php index f71a2d26441ef..aeb7767c56578 100644 --- a/app/code/Magento/Backend/ViewModel/ChartDisabled.php +++ b/app/code/Magento/Backend/ViewModel/ChartDisabled.php @@ -57,7 +57,7 @@ public function __construct( public function getConfigUrl(): string { return $this->urlBuilder->getUrl( - static::ROUTE_SYSTEM_CONFIG, + self::ROUTE_SYSTEM_CONFIG, ['section' => 'admin', '_fragment' => 'admin_dashboard-link'] ); } @@ -70,7 +70,7 @@ public function getConfigUrl(): string public function isChartEnabled(): bool { return $this->scopeConfig->isSetFlag( - static::XML_PATH_ENABLE_CHARTS, + self::XML_PATH_ENABLE_CHARTS, ScopeInterface::SCOPE_STORE ); } diff --git a/app/code/Magento/Catalog/Model/Config/LayerCategoryConfig.php b/app/code/Magento/Catalog/Model/Config/LayerCategoryConfig.php index 0e8565e3b25d1..b6896929e0f5a 100644 --- a/app/code/Magento/Catalog/Model/Config/LayerCategoryConfig.php +++ b/app/code/Magento/Catalog/Model/Config/LayerCategoryConfig.php @@ -60,7 +60,7 @@ public function isCategoryFilterVisibleInLayerNavigation( } return $this->scopeConfig->isSetFlag( - static::XML_PATH_CATALOG_LAYERED_NAVIGATION_DISPLAY_CATEGORY, + self::XML_PATH_CATALOG_LAYERED_NAVIGATION_DISPLAY_CATEGORY, $scopeType, $scopeCode ); diff --git a/app/code/Magento/DownloadableImportExport/Model/Import/Product/Type/Downloadable.php b/app/code/Magento/DownloadableImportExport/Model/Import/Product/Type/Downloadable.php index a45fded76325f..5d6989aac6403 100644 --- a/app/code/Magento/DownloadableImportExport/Model/Import/Product/Type/Downloadable.php +++ b/app/code/Magento/DownloadableImportExport/Model/Import/Product/Type/Downloadable.php @@ -370,12 +370,12 @@ protected function isRowValidSample(array $rowData) foreach ($sampleData as $link) { if ($this->hasDomainNotInWhitelist($link, 'link_type', 'link_url')) { - $this->_entityModel->addRowError(static::ERROR_LINK_URL_NOT_IN_DOMAIN_WHITELIST, $this->rowNum); + $this->_entityModel->addRowError(self::ERROR_LINK_URL_NOT_IN_DOMAIN_WHITELIST, $this->rowNum); $result = true; } if ($this->hasDomainNotInWhitelist($link, 'sample_type', 'sample_url')) { - $this->_entityModel->addRowError(static::ERROR_SAMPLE_URL_NOT_IN_DOMAIN_WHITELIST, $this->rowNum); + $this->_entityModel->addRowError(self::ERROR_SAMPLE_URL_NOT_IN_DOMAIN_WHITELIST, $this->rowNum); $result = true; } } @@ -406,12 +406,12 @@ protected function isRowValidLink(array $rowData) foreach ($linkData as $link) { if ($this->hasDomainNotInWhitelist($link, 'link_type', 'link_url')) { - $this->_entityModel->addRowError(static::ERROR_LINK_URL_NOT_IN_DOMAIN_WHITELIST, $this->rowNum); + $this->_entityModel->addRowError(self::ERROR_LINK_URL_NOT_IN_DOMAIN_WHITELIST, $this->rowNum); $result = true; } if ($this->hasDomainNotInWhitelist($link, 'sample_type', 'sample_url')) { - $this->_entityModel->addRowError(static::ERROR_SAMPLE_URL_NOT_IN_DOMAIN_WHITELIST, $this->rowNum); + $this->_entityModel->addRowError(self::ERROR_SAMPLE_URL_NOT_IN_DOMAIN_WHITELIST, $this->rowNum); $result = true; } }