From 693a02eb9af3c706b93d8e5be7316474e105a36b Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Thu, 19 Sep 2024 17:20:26 +0200 Subject: [PATCH] Fixes --- app/code/core/Mage/Catalog/Model/Product.php | 2 +- .../core/Mage/Catalog/Model/Product/Type/Abstract.php | 2 +- app/code/core/Mage/Cms/Model/Page.php | 5 ----- app/code/core/Mage/GoogleAnalytics/Block/Ga.php | 10 +++++----- tests/unit/Mage/AdminNotification/Model/FeedTest.php | 3 --- .../Block/Customer/Edit/Tab/NewsletterTest.php | 1 - tests/unit/Mage/Cms/Block/Widget/BlockTest.php | 3 --- tests/unit/Mage/Cms/Block/Widget/Page/LinkTest.php | 3 --- tests/unit/Mage/Cms/Helper/Wysiwyg/ImagesTest.php | 3 --- tests/unit/Mage/Cms/Model/PageTest.php | 3 --- tests/unit/Mage/Cms/Model/Wysiwyg/ConfigTest.php | 3 --- .../unit/Mage/Cms/Model/Wysiwyg/Images/StorageTest.php | 3 --- tests/unit/Mage/Customer/Model/CustomerTest.php | 3 --- tests/unit/Mage/Log/Model/AggregationTest.php | 3 --- tests/unit/Mage/Log/Model/CustomerTest.php | 3 --- 15 files changed, 7 insertions(+), 43 deletions(-) diff --git a/app/code/core/Mage/Catalog/Model/Product.php b/app/code/core/Mage/Catalog/Model/Product.php index ac9d7a3dfac..34bfefa3a8f 100644 --- a/app/code/core/Mage/Catalog/Model/Product.php +++ b/app/code/core/Mage/Catalog/Model/Product.php @@ -699,7 +699,7 @@ public function getStockItem() */ public function hasStockItem() { - return !!$this->_stockItem; + return (bool) $this->_stockItem; } /** diff --git a/app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php b/app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php index 288dbf1db98..05e68872e2b 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php +++ b/app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php @@ -561,7 +561,7 @@ public function checkProductBuyState($product = null) if ($option->getIsRequire()) { $customOption = $this->getProduct($product) ->getCustomOption(self::OPTION_PREFIX . $option->getId()); - if (!$customOption || $customOption->getValue() === null || strlen($customOption->getValue()) === 0) { + if (!$customOption || $customOption->getValue() === null || (string) $customOption->getValue() === '') { $this->getProduct($product)->setSkipCheckRequiredOption(true); Mage::throwException( Mage::helper('catalog')->__('The product has required options') diff --git a/app/code/core/Mage/Cms/Model/Page.php b/app/code/core/Mage/Cms/Model/Page.php index beb9d8b5eb3..f488fd8c894 100644 --- a/app/code/core/Mage/Cms/Model/Page.php +++ b/app/code/core/Mage/Cms/Model/Page.php @@ -126,9 +126,6 @@ public function checkIdentifier($identifier, $storeId) /** * Retrieves cms page title from DB by passed identifier. - * - * @param string $identifier - * @return string */ public function getCmsPageTitleByIdentifier(string $identifier): string { @@ -139,7 +136,6 @@ public function getCmsPageTitleByIdentifier(string $identifier): string * Retrieves cms page title from DB by passed id. * * @param string|int $id - * @return string */ public function getCmsPageTitleById($id): string { @@ -150,7 +146,6 @@ public function getCmsPageTitleById($id): string * Retrieves cms page identifier from DB by passed id. * * @param string|int $id - * @return string */ public function getCmsPageIdentifierById($id): string { diff --git a/app/code/core/Mage/GoogleAnalytics/Block/Ga.php b/app/code/core/Mage/GoogleAnalytics/Block/Ga.php index b289ab86a0e..09767cc10c5 100644 --- a/app/code/core/Mage/GoogleAnalytics/Block/Ga.php +++ b/app/code/core/Mage/GoogleAnalytics/Block/Ga.php @@ -204,7 +204,7 @@ protected function _getEnhancedEcommerceDataForAnalytics4() if ($productViewed->getAttributeText('manufacturer')) { $_item['item_brand'] = $productViewed->getAttributeText('manufacturer'); } - array_push($eventData['items'], $_item); + $eventData['items'][] = $_item; $result[] = ['view_item', $eventData]; } elseif ($moduleName == 'catalog' && $controllerName == 'category') { // Log this event when the user has been presented with a list of items of a certain category. @@ -241,7 +241,7 @@ protected function _getEnhancedEcommerceDataForAnalytics4() if ($productViewed->getCategory()->getName()) { $_item['item_category'] = $productViewed->getCategory()->getName(); } - array_push($eventData['items'], $_item); + $eventData['items'][] = $_item; $index++; $eventData['value'] += $productViewed->getFinalPrice(); } @@ -274,7 +274,7 @@ protected function _getEnhancedEcommerceDataForAnalytics4() if ($itemCategory) { $_item['item_category'] = $itemCategory; } - array_push($eventData['items'], $_item); + $eventData['items'][] = $_item; $eventData['value'] += $_product->getFinalPrice() * $productInCart->getQty(); } $eventData['value'] = $helper->formatPrice($eventData['value']); @@ -306,7 +306,7 @@ protected function _getEnhancedEcommerceDataForAnalytics4() if ($itemCategory) { $_item['item_category'] = $itemCategory; } - array_push($eventData['items'], $_item); + $eventData['items'][] = $_item; $eventData['value'] += $_product->getFinalPrice(); } $eventData['value'] = $helper->formatPrice($eventData['value']); @@ -352,7 +352,7 @@ protected function _getEnhancedEcommerceDataForAnalytics4() if ($itemCategory) { $_item['item_category'] = $itemCategory; } - array_push($orderData['items'], $_item); + $orderData['items'][] = $_item; } $result[] = ['purchase', $orderData]; } diff --git a/tests/unit/Mage/AdminNotification/Model/FeedTest.php b/tests/unit/Mage/AdminNotification/Model/FeedTest.php index c5ef6917895..0bc2d458d4c 100644 --- a/tests/unit/Mage/AdminNotification/Model/FeedTest.php +++ b/tests/unit/Mage/AdminNotification/Model/FeedTest.php @@ -23,9 +23,6 @@ class FeedTest extends TestCase { - /** - * @var Mage_AdminNotification_Model_Feed - */ public Mage_AdminNotification_Model_Feed $subject; public function setUp(): void diff --git a/tests/unit/Mage/Adminhtml/Block/Customer/Edit/Tab/NewsletterTest.php b/tests/unit/Mage/Adminhtml/Block/Customer/Edit/Tab/NewsletterTest.php index 817bcf863d2..94a24582212 100644 --- a/tests/unit/Mage/Adminhtml/Block/Customer/Edit/Tab/NewsletterTest.php +++ b/tests/unit/Mage/Adminhtml/Block/Customer/Edit/Tab/NewsletterTest.php @@ -34,7 +34,6 @@ public function setUp(): void } /** - * @return void * * @group Mage_Adminhtml * @group Mage_Adminhtml_Block diff --git a/tests/unit/Mage/Cms/Block/Widget/BlockTest.php b/tests/unit/Mage/Cms/Block/Widget/BlockTest.php index 481a048740c..32e53b340b2 100644 --- a/tests/unit/Mage/Cms/Block/Widget/BlockTest.php +++ b/tests/unit/Mage/Cms/Block/Widget/BlockTest.php @@ -23,9 +23,6 @@ class BlockTest extends TestCase { - /** - * @var Mage_Cms_Block_Widget_Block - */ public Mage_Cms_Block_Widget_Block $subject; public function setUp(): void diff --git a/tests/unit/Mage/Cms/Block/Widget/Page/LinkTest.php b/tests/unit/Mage/Cms/Block/Widget/Page/LinkTest.php index 65205901b21..a08bf86c9e2 100644 --- a/tests/unit/Mage/Cms/Block/Widget/Page/LinkTest.php +++ b/tests/unit/Mage/Cms/Block/Widget/Page/LinkTest.php @@ -23,9 +23,6 @@ class LinkTest extends TestCase { - /** - * @var Mage_Cms_Block_Widget_Page_Link - */ public Mage_Cms_Block_Widget_Page_Link $subject; public function setUp(): void diff --git a/tests/unit/Mage/Cms/Helper/Wysiwyg/ImagesTest.php b/tests/unit/Mage/Cms/Helper/Wysiwyg/ImagesTest.php index 8139c185075..d84135dbafb 100644 --- a/tests/unit/Mage/Cms/Helper/Wysiwyg/ImagesTest.php +++ b/tests/unit/Mage/Cms/Helper/Wysiwyg/ImagesTest.php @@ -26,9 +26,6 @@ class ImagesTest extends TestCase { public const TEST_STRING = '0123456789'; - /** - * @var Mage_Cms_Helper_Wysiwyg_Images - */ public Mage_Cms_Helper_Wysiwyg_Images $subject; public function setUp(): void diff --git a/tests/unit/Mage/Cms/Model/PageTest.php b/tests/unit/Mage/Cms/Model/PageTest.php index 3b318a2f15c..5e5779c8a2b 100644 --- a/tests/unit/Mage/Cms/Model/PageTest.php +++ b/tests/unit/Mage/Cms/Model/PageTest.php @@ -23,9 +23,6 @@ class PageTest extends TestCase { - /** - * @var Mage_Cms_Model_Page - */ public Mage_Cms_Model_Page $subject; public function setUp(): void diff --git a/tests/unit/Mage/Cms/Model/Wysiwyg/ConfigTest.php b/tests/unit/Mage/Cms/Model/Wysiwyg/ConfigTest.php index 45dc4949635..c106ba0c128 100644 --- a/tests/unit/Mage/Cms/Model/Wysiwyg/ConfigTest.php +++ b/tests/unit/Mage/Cms/Model/Wysiwyg/ConfigTest.php @@ -26,9 +26,6 @@ class ConfigTest extends TestCase { public const TEST_STRING = '0123456789'; - /** - * @var Mage_Cms_Model_Wysiwyg_Config - */ public Mage_Cms_Model_Wysiwyg_Config $subject; public function setUp(): void diff --git a/tests/unit/Mage/Cms/Model/Wysiwyg/Images/StorageTest.php b/tests/unit/Mage/Cms/Model/Wysiwyg/Images/StorageTest.php index d0d85f845ec..cdbf85fd8ff 100644 --- a/tests/unit/Mage/Cms/Model/Wysiwyg/Images/StorageTest.php +++ b/tests/unit/Mage/Cms/Model/Wysiwyg/Images/StorageTest.php @@ -27,9 +27,6 @@ class StorageTest extends TestCase { public const TEST_STRING = '0123456789'; - /** - * @var Mage_Cms_Model_Wysiwyg_Images_Storage - */ public Mage_Cms_Model_Wysiwyg_Images_Storage $subject; public function setUp(): void diff --git a/tests/unit/Mage/Customer/Model/CustomerTest.php b/tests/unit/Mage/Customer/Model/CustomerTest.php index 4accfe15f34..e6d4cb953eb 100644 --- a/tests/unit/Mage/Customer/Model/CustomerTest.php +++ b/tests/unit/Mage/Customer/Model/CustomerTest.php @@ -24,9 +24,6 @@ class CustomerTest extends TestCase { - /** - * @var Mage_Customer_Model_Customer - */ public Mage_Customer_Model_Customer $subject; public function setUp(): void diff --git a/tests/unit/Mage/Log/Model/AggregationTest.php b/tests/unit/Mage/Log/Model/AggregationTest.php index ee6192d3cce..129d0f39c1a 100644 --- a/tests/unit/Mage/Log/Model/AggregationTest.php +++ b/tests/unit/Mage/Log/Model/AggregationTest.php @@ -23,9 +23,6 @@ class AggregationTest extends TestCase { - /** - * @var Mage_Log_Model_Aggregation - */ public Mage_Log_Model_Aggregation $subject; public function setUp(): void diff --git a/tests/unit/Mage/Log/Model/CustomerTest.php b/tests/unit/Mage/Log/Model/CustomerTest.php index 8261eeb49cb..532f9526426 100644 --- a/tests/unit/Mage/Log/Model/CustomerTest.php +++ b/tests/unit/Mage/Log/Model/CustomerTest.php @@ -23,9 +23,6 @@ class CustomerTest extends TestCase { - /** - * @var Mage_Log_Model_Customer - */ public Mage_Log_Model_Customer $subject; public function setUp(): void