8
8
9
9
use Magento \Catalog \Api \CategoryRepositoryInterface ;
10
10
use Magento \Catalog \Block \Product \AbstractProduct ;
11
+ use Magento \Catalog \Block \Product \Context ;
11
12
use Magento \Catalog \Block \Product \Widget \Html \Pager ;
12
13
use Magento \Catalog \Model \Product ;
13
14
use Magento \Catalog \Model \Product \Visibility ;
16
17
use Magento \Catalog \Pricing \Price \FinalPrice ;
17
18
use Magento \CatalogWidget \Model \Rule ;
18
19
use Magento \Framework \App \ActionInterface ;
19
- use Magento \Framework \App \Http \Context ;
20
+ use Magento \Framework \App \Http \Context as HttpContext ;
20
21
use Magento \Framework \App \ObjectManager ;
21
22
use Magento \Framework \DataObject \IdentityInterface ;
22
23
use Magento \Framework \Exception \LocalizedException ;
27
28
use Magento \Framework \View \LayoutFactory ;
28
29
use Magento \Framework \View \LayoutInterface ;
29
30
use Magento \Rule \Model \Condition \Combine ;
30
- use Magento \Rule \Model \Condition \Sql \Builder ;
31
+ use Magento \Rule \Model \Condition \Sql \Builder as SqlBuilder ;
31
32
use Magento \Widget \Block \BlockInterface ;
32
33
use Magento \Widget \Helper \Conditions ;
33
34
@@ -69,7 +70,7 @@ class ProductsList extends AbstractProduct implements BlockInterface, IdentityIn
69
70
protected $ pager ;
70
71
71
72
/**
72
- * @var Context
73
+ * @var HttpContext
73
74
*/
74
75
protected $ httpContext ;
75
76
@@ -88,7 +89,7 @@ class ProductsList extends AbstractProduct implements BlockInterface, IdentityIn
88
89
protected $ productCollectionFactory ;
89
90
90
91
/**
91
- * @var Builder
92
+ * @var SqlBuilder
92
93
*/
93
94
protected $ sqlBuilder ;
94
95
@@ -135,34 +136,34 @@ class ProductsList extends AbstractProduct implements BlockInterface, IdentityIn
135
136
private $ categoryRepository ;
136
137
137
138
/**
138
- * @param \Magento\Catalog\Block\Product\ Context $context
139
+ * @param Context $context
139
140
* @param CollectionFactory $productCollectionFactory
140
141
* @param Visibility $catalogProductVisibility
141
- * @param Context $httpContext
142
- * @param Builder $sqlBuilder
142
+ * @param HttpContext $httpContext
143
+ * @param SqlBuilder $sqlBuilder
143
144
* @param Rule $rule
144
145
* @param Conditions $conditionsHelper
145
- * @param CategoryRepositoryInterface $categoryRepository
146
146
* @param array $data
147
147
* @param Json|null $json
148
148
* @param LayoutFactory|null $layoutFactory
149
149
* @param EncoderInterface|null $urlEncoder
150
+ * @param CategoryRepositoryInterface|null $categoryRepository
150
151
*
151
152
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
152
153
*/
153
154
public function __construct (
154
- \ Magento \ Catalog \ Block \ Product \ Context $ context ,
155
+ Context $ context ,
155
156
CollectionFactory $ productCollectionFactory ,
156
157
Visibility $ catalogProductVisibility ,
157
- Context $ httpContext ,
158
- Builder $ sqlBuilder ,
158
+ HttpContext $ httpContext ,
159
+ SqlBuilder $ sqlBuilder ,
159
160
Rule $ rule ,
160
161
Conditions $ conditionsHelper ,
161
- CategoryRepositoryInterface $ categoryRepository ,
162
162
array $ data = [],
163
163
Json $ json = null ,
164
164
LayoutFactory $ layoutFactory = null ,
165
- EncoderInterface $ urlEncoder = null
165
+ EncoderInterface $ urlEncoder = null ,
166
+ CategoryRepositoryInterface $ categoryRepository = null
166
167
) {
167
168
$ this ->productCollectionFactory = $ productCollectionFactory ;
168
169
$ this ->catalogProductVisibility = $ catalogProductVisibility ;
@@ -173,7 +174,8 @@ public function __construct(
173
174
$ this ->json = $ json ?: ObjectManager::getInstance ()->get (Json::class);
174
175
$ this ->layoutFactory = $ layoutFactory ?: ObjectManager::getInstance ()->get (LayoutFactory::class);
175
176
$ this ->urlEncoder = $ urlEncoder ?: ObjectManager::getInstance ()->get (EncoderInterface::class);
176
- $ this ->categoryRepository = $ categoryRepository ;
177
+ $ this ->categoryRepository = $ categoryRepository ?? ObjectManager::getInstance ()
178
+ ->get (CategoryRepositoryInterface::class);
177
179
parent ::__construct (
178
180
$ context ,
179
181
$ data
0 commit comments