diff --git a/app/code/Magento/Catalog/Model/Api/SearchCriteria/CollectionProcessor/FilterProcessor/ProductCategoryFilter.php b/app/code/Magento/Catalog/Model/Api/SearchCriteria/CollectionProcessor/FilterProcessor/ProductCategoryFilter.php index e0fbc16421f55..f8cf810ffb570 100644 --- a/app/code/Magento/Catalog/Model/Api/SearchCriteria/CollectionProcessor/FilterProcessor/ProductCategoryFilter.php +++ b/app/code/Magento/Catalog/Model/Api/SearchCriteria/CollectionProcessor/FilterProcessor/ProductCategoryFilter.php @@ -21,7 +21,7 @@ class ProductCategoryFilter implements CustomFilterInterface */ public function apply(Filter $filter, AbstractDb $collection) { - $conditionType = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; + $conditionType = $filter->getConditionType() ?: 'eq'; $categoryFilter = [$conditionType => [$filter->getValue()]]; /** @var Collection $collection */ diff --git a/app/code/Magento/Catalog/Model/CategoryRepository.php b/app/code/Magento/Catalog/Model/CategoryRepository.php index 8cb11c4306d52..7485d9f6cb247 100644 --- a/app/code/Magento/Catalog/Model/CategoryRepository.php +++ b/app/code/Magento/Catalog/Model/CategoryRepository.php @@ -129,7 +129,7 @@ public function save(\Magento\Catalog\Api\Data\CategoryInterface $category) */ public function get($categoryId, $storeId = null) { - $cacheKey = null !== $storeId ? $storeId : 'all'; + $cacheKey = $storeId ?? 'all'; if (!isset($this->instances[$categoryId][$cacheKey])) { /** @var Category $category */ $category = $this->categoryFactory->create(); diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index 9bb3562a8b1c0..f8be5ea644b0c 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -2006,7 +2006,7 @@ public function getIsVirtual() */ public function addCustomOption($code, $value, $product = null) { - $product = $product ? $product : $this; + $product = $product ?: $this; $option = $this->_itemOptionFactory->create()->addData( ['product_id' => $product->getId(), 'product' => $product, 'code' => $code, 'value' => $value] ); diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php index aecb8525915d7..9f1eae207e116 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php @@ -127,7 +127,7 @@ public function __construct( $this->mediaDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::MEDIA); $this->validatorInfo = $validatorInfo; $this->validatorFile = $validatorFile; - $this->serializer = $serializer ? $serializer : ObjectManager::getInstance()->get(Json::class); + $this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class); parent::__construct($checkoutSession, $scopeConfig, $data); } diff --git a/app/code/Magento/Catalog/Model/Product/ProductList/Toolbar.php b/app/code/Magento/Catalog/Model/Product/ProductList/Toolbar.php index c2046bea550e6..af0772251e235 100644 --- a/app/code/Magento/Catalog/Model/Product/ProductList/Toolbar.php +++ b/app/code/Magento/Catalog/Model/Product/ProductList/Toolbar.php @@ -102,6 +102,6 @@ public function getLimit() public function getCurrentPage() { $page = (int) $this->request->getParam(self::PAGE_PARM_NAME); - return $page ? $page : 1; + return $page ?: 1; } } diff --git a/app/code/Magento/Catalog/Model/Product/Type/Price.php b/app/code/Magento/Catalog/Model/Product/Type/Price.php index aa28a3478ebf7..7eaedf77eb859 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Price.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Price.php @@ -341,7 +341,7 @@ public function getTierPrice($qty, $product) } } - return $prices ? $prices : []; + return $prices ?: []; } /** diff --git a/app/code/Magento/Catalog/Model/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php index e3329832e134a..6a82658342824 100644 --- a/app/code/Magento/Catalog/Model/ProductRepository.php +++ b/app/code/Magento/Catalog/Model/ProductRepository.php @@ -740,7 +740,7 @@ protected function addFilterGroupToCollection( $fields = []; $categoryFilter = []; foreach ($filterGroup->getFilters() as $filter) { - $conditionType = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; + $conditionType = $filter->getConditionType() ?: 'eq'; if ($filter->getField() == 'category_id') { $categoryFilter[$conditionType][] = $filter->getValue(); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Api/SearchCriteria/CollectionProcessor/FilterProcessor/ProductCategoryFilterTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Api/SearchCriteria/CollectionProcessor/FilterProcessor/ProductCategoryFilterTest.php index f667638cc4da8..942a87ce3414f 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Api/SearchCriteria/CollectionProcessor/FilterProcessor/ProductCategoryFilterTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Api/SearchCriteria/CollectionProcessor/FilterProcessor/ProductCategoryFilterTest.php @@ -31,7 +31,7 @@ public function testApply() ->disableOriginalConstructor() ->getMock(); - $filterMock->expects($this->exactly(2)) + $filterMock->expects($this->exactly(1)) ->method('getConditionType') ->willReturn('condition'); $filterMock->expects($this->once())