88
99use Magento \Catalog \Api \CategoryRepositoryInterface ;
1010use Magento \Catalog \Block \Product \AbstractProduct ;
11+ use Magento \Catalog \Block \Product \Context ;
1112use Magento \Catalog \Block \Product \Widget \Html \Pager ;
1213use Magento \Catalog \Model \Product ;
1314use Magento \Catalog \Model \Product \Visibility ;
1617use Magento \Catalog \Pricing \Price \FinalPrice ;
1718use Magento \CatalogWidget \Model \Rule ;
1819use Magento \Framework \App \ActionInterface ;
19- use Magento \Framework \App \Http \Context ;
20+ use Magento \Framework \App \Http \Context as HttpContext ;
2021use Magento \Framework \App \ObjectManager ;
2122use Magento \Framework \DataObject \IdentityInterface ;
2223use Magento \Framework \Exception \LocalizedException ;
2728use Magento \Framework \View \LayoutFactory ;
2829use Magento \Framework \View \LayoutInterface ;
2930use Magento \Rule \Model \Condition \Combine ;
30- use Magento \Rule \Model \Condition \Sql \Builder ;
31+ use Magento \Rule \Model \Condition \Sql \Builder as SqlBuilder ;
3132use Magento \Widget \Block \BlockInterface ;
3233use Magento \Widget \Helper \Conditions ;
3334
@@ -69,7 +70,7 @@ class ProductsList extends AbstractProduct implements BlockInterface, IdentityIn
6970 protected $ pager ;
7071
7172 /**
72- * @var Context
73+ * @var HttpContext
7374 */
7475 protected $ httpContext ;
7576
@@ -88,7 +89,7 @@ class ProductsList extends AbstractProduct implements BlockInterface, IdentityIn
8889 protected $ productCollectionFactory ;
8990
9091 /**
91- * @var Builder
92+ * @var SqlBuilder
9293 */
9394 protected $ sqlBuilder ;
9495
@@ -135,34 +136,34 @@ class ProductsList extends AbstractProduct implements BlockInterface, IdentityIn
135136 private $ categoryRepository ;
136137
137138 /**
138- * @param \Magento\Catalog\Block\Product\ Context $context
139+ * @param Context $context
139140 * @param CollectionFactory $productCollectionFactory
140141 * @param Visibility $catalogProductVisibility
141- * @param Context $httpContext
142- * @param Builder $sqlBuilder
142+ * @param HttpContext $httpContext
143+ * @param SqlBuilder $sqlBuilder
143144 * @param Rule $rule
144145 * @param Conditions $conditionsHelper
145- * @param CategoryRepositoryInterface $categoryRepository
146146 * @param array $data
147147 * @param Json|null $json
148148 * @param LayoutFactory|null $layoutFactory
149149 * @param EncoderInterface|null $urlEncoder
150+ * @param CategoryRepositoryInterface|null $categoryRepository
150151 *
151152 * @SuppressWarnings(PHPMD.ExcessiveParameterList)
152153 */
153154 public function __construct (
154- \ Magento \ Catalog \ Block \ Product \ Context $ context ,
155+ Context $ context ,
155156 CollectionFactory $ productCollectionFactory ,
156157 Visibility $ catalogProductVisibility ,
157- Context $ httpContext ,
158- Builder $ sqlBuilder ,
158+ HttpContext $ httpContext ,
159+ SqlBuilder $ sqlBuilder ,
159160 Rule $ rule ,
160161 Conditions $ conditionsHelper ,
161- CategoryRepositoryInterface $ categoryRepository ,
162162 array $ data = [],
163163 Json $ json = null ,
164164 LayoutFactory $ layoutFactory = null ,
165- EncoderInterface $ urlEncoder = null
165+ EncoderInterface $ urlEncoder = null ,
166+ CategoryRepositoryInterface $ categoryRepository = null
166167 ) {
167168 $ this ->productCollectionFactory = $ productCollectionFactory ;
168169 $ this ->catalogProductVisibility = $ catalogProductVisibility ;
@@ -173,7 +174,8 @@ public function __construct(
173174 $ this ->json = $ json ?: ObjectManager::getInstance ()->get (Json::class);
174175 $ this ->layoutFactory = $ layoutFactory ?: ObjectManager::getInstance ()->get (LayoutFactory::class);
175176 $ this ->urlEncoder = $ urlEncoder ?: ObjectManager::getInstance ()->get (EncoderInterface::class);
176- $ this ->categoryRepository = $ categoryRepository ;
177+ $ this ->categoryRepository = $ categoryRepository ?? ObjectManager::getInstance ()
178+ ->get (CategoryRepositoryInterface::class);
177179 parent ::__construct (
178180 $ context ,
179181 $ data
0 commit comments