Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[32059] [To 2.4-develop] Update classes and interfaces and mark them as API part 3 #32738

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 56 additions & 40 deletions app/code/Magento/Catalog/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,25 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Catalog\Model;

use Magento\Catalog\Model\Product\TypeFactory;
use Magento\Catalog\Model\ResourceModel\ConfigFactory;
use Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory;
use Magento\Framework\App\Cache\StateInterface;
use Magento\Framework\App\CacheInterface;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\Serialize\SerializerInterface;
use Magento\Framework\Validator\UniversalFactory;
use Magento\Store\Model\StoreManagerInterface;

/**
* Catalog config model.
*
* @api
*
* @SuppressWarnings(PHPMD.LongVariable)
* @SuppressWarnings(PHPMD.TooManyFields)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
Expand All @@ -22,135 +33,140 @@ class Config extends \Magento\Eav\Model\Config
/**
* @var mixed
*/
protected $_attributeSetsById;
private $_attributeSetsById;

/**
* @var mixed
*/
private $_attributeSetsByName;

/**
* @var mixed
*/
protected $_attributeSetsByName;
private $_attributeGroupsById;

/**
* @var mixed
*/
protected $_attributeGroupsById;
private $_attributeGroupsByName;

/**
* @var mixed
*/
protected $_attributeGroupsByName;
private $_productTypesById;

/**
* @var mixed
*/
protected $_productTypesById;
private $_productTypesByName;

/**
* Array of attributes codes needed for product load
*
* @var array
*/
protected $_productAttributes;
private $_productAttributes;

/**
* Product Attributes used in product listing
*
* @var array
*/
protected $_usedInProductListing;
private $_usedInProductListing;

/**
* Product Attributes For Sort By
*
* @var array
*/
protected $_usedForSortBy;
private $_usedForSortBy;

/**
* @var int|float|string|null
*/
protected $_storeId = null;
private $_storeId = null;

/**
* Core store config
*
* @var \Magento\Framework\App\Config\ScopeConfigInterface
* @var ScopeConfigInterface
*/
protected $_scopeConfig;
private $_scopeConfig;

/**
* Eav config
*
* @var \Magento\Eav\Model\Config
*/
protected $_eavConfig;
private $_eavConfig;

/**
* Store manager
*
* @var \Magento\Store\Model\StoreManagerInterface
* @var StoreManagerInterface
*/
protected $_storeManager;
private $_storeManager;

/**
* Set collection factory
*
* @var \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory
* @var CollectionFactory
*/
protected $_setCollectionFactory;
private $_setCollectionFactory;

/**
* Group collection factory
*
* @var \Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\CollectionFactory
*/
protected $_groupCollectionFactory;
private $_groupCollectionFactory;

/**
* Product type factory
*
* @var \Magento\Catalog\Model\Product\TypeFactory
* @var TypeFactory
*/
protected $_productTypeFactory;
private $_productTypeFactory;

/**
* Config factory
*
* @var \Magento\Catalog\Model\ResourceModel\ConfigFactory
* @var ConfigFactory
*/
protected $_configFactory;
private $_configFactory;

/**
* Constructor
*
* @param \Magento\Framework\App\CacheInterface $cache
* @param CacheInterface $cache
* @param \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory
* @param \Magento\Eav\Model\ResourceModel\Entity\Type\CollectionFactory $entityTypeCollectionFactory,
* @param \Magento\Framework\App\Cache\StateInterface $cacheState
* @param \Magento\Framework\Validator\UniversalFactory $universalFactory
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Magento\Catalog\Model\ResourceModel\ConfigFactory $configFactory
* @param \Magento\Catalog\Model\Product\TypeFactory $productTypeFactory
* @param StateInterface $cacheState
* @param UniversalFactory $universalFactory
* @param ScopeConfigInterface $scopeConfig
* @param ConfigFactory $configFactory
* @param TypeFactory $productTypeFactory
* @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\CollectionFactory $groupCollectionFactory
* @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory $setCollectionFactory
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param CollectionFactory $setCollectionFactory
* @param StoreManagerInterface $storeManager
* @param \Magento\Eav\Model\Config $eavConfig
* @param SerializerInterface $serializer
* @param array $attributesForPreload
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
\Magento\Framework\App\CacheInterface $cache,
CacheInterface $cache,
\Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory,
\Magento\Eav\Model\ResourceModel\Entity\Type\CollectionFactory $entityTypeCollectionFactory,
\Magento\Framework\App\Cache\StateInterface $cacheState,
\Magento\Framework\Validator\UniversalFactory $universalFactory,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Catalog\Model\ResourceModel\ConfigFactory $configFactory,
\Magento\Catalog\Model\Product\TypeFactory $productTypeFactory,
StateInterface $cacheState,
UniversalFactory $universalFactory,
ScopeConfigInterface $scopeConfig,
ConfigFactory $configFactory,
TypeFactory $productTypeFactory,
\Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\CollectionFactory $groupCollectionFactory,
\Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory $setCollectionFactory,
\Magento\Store\Model\StoreManagerInterface $storeManager,
CollectionFactory $setCollectionFactory,
StoreManagerInterface $storeManager,
\Magento\Eav\Model\Config $eavConfig,
SerializerInterface $serializer = null,
$attributesForPreload = []
Expand Down Expand Up @@ -182,14 +198,14 @@ public function __construct(
*/
protected function _construct()
{
$this->_init(\Magento\Catalog\Model\ResourceModel\Config::class);
$this->_init(ResourceModel\Config::class);
}

/**
* Set store id
*
* @param integer $storeId
* @return \Magento\Catalog\Model\Config
* @return Config
*/
public function setStoreId($storeId)
{
Expand Down Expand Up @@ -421,7 +437,7 @@ public function getProductAttributes()
/**
* Retrieve resource model
*
* @return \Magento\Catalog\Model\ResourceModel\Config
* @return ResourceModel\Config
*/
protected function _getResource()
{
Expand Down
36 changes: 21 additions & 15 deletions app/code/Magento/Catalog/Model/Layer/Filter/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,46 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Catalog\Model\Layer\Filter;

use Magento\Framework\DataObject;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\UrlInterface;
use Magento\Theme\Block\Html\Pager;

/**
* Filter item model
*
* @author Magento Core Team <[email protected]>
* @api
*/
namespace Magento\Catalog\Model\Layer\Filter;

class Item extends \Magento\Framework\DataObject
class Item extends DataObject
{
/**
* Url
*
* @var \Magento\Framework\UrlInterface
* @var UrlInterface
*/
protected $_url;
private $_url;

/**
* Html pager block
*
* @var \Magento\Theme\Block\Html\Pager
* @var Pager
*/
protected $_htmlPagerBlock;
private $_htmlPagerBlock;

/**
* Construct
*
* @param \Magento\Framework\UrlInterface $url
* @param \Magento\Theme\Block\Html\Pager $htmlPagerBlock
* @param UrlInterface $url
* @param Pager $htmlPagerBlock
* @param array $data
*/
public function __construct(
\Magento\Framework\UrlInterface $url,
\Magento\Theme\Block\Html\Pager $htmlPagerBlock,
UrlInterface $url,
Pager $htmlPagerBlock,
array $data = []
) {
$this->_url = $url;
Expand All @@ -47,14 +53,14 @@ public function __construct(
/**
* Get filter instance
*
* @return \Magento\Catalog\Model\Layer\Filter\AbstractFilter
* @throws \Magento\Framework\Exception\LocalizedException
* @return AbstractFilter
* @throws LocalizedException
*/
public function getFilter()
{
$filter = $this->getData('filter');
if (!is_object($filter)) {
throw new \Magento\Framework\Exception\LocalizedException(
throw new LocalizedException(
__('The filter must be an object. Please set the correct filter.')
);
}
Expand Down
6 changes: 3 additions & 3 deletions app/code/Magento/Catalog/Test/Unit/Model/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ public function testGetSourceOptionId($expected, $data, $search)
public function getSourceOptionIdDataProvider()
{
return [
[1, [['label' => 'name', 'value' => 1]], 1],
[1, [['label' => 'name', 'value' => 1]], 'name'],
[null, [['label' => 'name', 'value' => 1]], 2],
['1', [['label' => 'name', 'value' => '1']], '1'],
['1', [['label' => 'name', 'value' => '1']], 'name'],
[null, [['label' => 'name', 'value' => '1']], '2'],
];
}

Expand Down
Loading