Skip to content

Commit 18258b6

Browse files
karyna-tandrewbess
authored andcommitted
magento#34505: fix failed static tests
1 parent d45631e commit 18258b6

File tree

8 files changed

+46
-46
lines changed

8 files changed

+46
-46
lines changed

app/code/Magento/Catalog/Helper/Image.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*
1717
* @api
1818
* @SuppressWarnings(PHPMD.TooManyFields)
19+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1920
* @since 100.0.2
2021
*/
2122
class Image extends AbstractHelper implements ArgumentInterface
@@ -47,8 +48,6 @@ class Image extends AbstractHelper implements ArgumentInterface
4748
protected $_scheduleRotate = false;
4849

4950
/**
50-
* Angle
51-
*
5251
* @var int
5352
*/
5453
protected $_angle;
@@ -61,22 +60,16 @@ class Image extends AbstractHelper implements ArgumentInterface
6160
protected $_watermark;
6261

6362
/**
64-
* Watermark Position
65-
*
6663
* @var string
6764
*/
6865
protected $_watermarkPosition;
6966

7067
/**
71-
* Watermark Size
72-
*
7368
* @var string
7469
*/
7570
protected $_watermarkSize;
7671

7772
/**
78-
* Watermark Image opacity
79-
*
8073
* @var int
8174
*/
8275
protected $_watermarkImageOpacity;
@@ -89,8 +82,6 @@ class Image extends AbstractHelper implements ArgumentInterface
8982
protected $_product;
9083

9184
/**
92-
* Image File
93-
*
9485
* @var string
9586
*/
9687
protected $_imageFile;
@@ -108,8 +99,6 @@ class Image extends AbstractHelper implements ArgumentInterface
10899
protected $_assetRepo;
109100

110101
/**
111-
* Product image factory
112-
*
113102
* @var \Magento\Catalog\Model\Product\ImageFactory
114103
*/
115104
protected $_productImageFactory;

app/code/Magento/Catalog/Model/Category.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements
7272

7373
const CACHE_TAG = 'cat_c';
7474

75-
/**#@-*/
75+
/**
76+
* @var string
77+
*/
7678
protected $_eventPrefix = 'catalog_category';
7779

7880
/**
@@ -157,29 +159,21 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements
157159
protected $filter;
158160

159161
/**
160-
* Catalog config
161-
*
162162
* @var \Magento\Catalog\Model\Config
163163
*/
164164
protected $_catalogConfig;
165165

166166
/**
167-
* Product collection factory
168-
*
169167
* @var \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory
170168
*/
171169
protected $_productCollectionFactory;
172170

173171
/**
174-
* Store collection factory
175-
*
176172
* @var \Magento\Store\Model\ResourceModel\Store\CollectionFactory
177173
*/
178174
protected $_storeCollectionFactory;
179175

180176
/**
181-
* Category tree factory
182-
*
183177
* @var \Magento\Catalog\Model\ResourceModel\Category\TreeFactory
184178
*/
185179
protected $_categoryTreeFactory;

app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ class DataProvider
155155
* @param int $antiGapMultiplier
156156
* @param GetSearchableProductsSelect|null $getSearchableProductsSelect
157157
* @throws Exception
158+
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
158159
*/
159160
public function __construct(
160161
ResourceConnection $resource,
@@ -210,7 +211,13 @@ public function getSearchableProducts(
210211
$lastProductId = 0,
211212
$batch = 100
212213
) {
213-
$select = $this->selectSearchableProducts->execute((int)$storeId, $staticFields, $productIds, $lastProductId, $batch);
214+
$select = $this->selectSearchableProducts->execute(
215+
(int) $storeId,
216+
$staticFields,
217+
$productIds,
218+
$lastProductId,
219+
$batch
220+
);
214221
if ($productIds === null) {
215222
$select->where(
216223
'e.entity_id < ?',
@@ -221,7 +228,13 @@ public function getSearchableProducts(
221228
if ($productIds === null && !$products) {
222229
// try to search without limit entity_id by batch size for cover case with a big gap between entity ids
223230
$products = $this->connection->fetchAll(
224-
$this->selectSearchableProducts->execute((int)$storeId, $staticFields, $productIds, $lastProductId, $batch)
231+
$this->selectSearchableProducts->execute(
232+
(int) $storeId,
233+
$staticFields,
234+
$productIds,
235+
$lastProductId,
236+
$batch
237+
)
225238
);
226239
}
227240

app/code/Magento/Quote/Model/Quote/Address.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@
132132
class Address extends AbstractAddress implements
133133
\Magento\Quote\Api\Data\AddressInterface
134134
{
135-
const RATES_FETCH = 1;
135+
public const RATES_FETCH = 1;
136136

137-
const RATES_RECALCULATE = 2;
137+
public const RATES_RECALCULATE = 2;
138138

139-
const ADDRESS_TYPE_BILLING = 'billing';
139+
public const ADDRESS_TYPE_BILLING = 'billing';
140140

141-
const ADDRESS_TYPE_SHIPPING = 'shipping';
141+
public const ADDRESS_TYPE_SHIPPING = 'shipping';
142142

143143
private const CACHED_ITEMS_ALL = 'cached_items_all';
144144

@@ -553,6 +553,7 @@ public function importCustomerAddressData(AddressInterface $address)
553553
);
554554

555555
$quote = $this->getQuote();
556+
// @phpstan-ignore-next-line as $quote can be empty
556557
if ($address->getCustomerId() && (!empty($quote) && $address->getCustomerId() == $quote->getCustomerId())) {
557558
$customer = $quote->getCustomer();
558559
$this->setEmail($customer->getEmail());

app/code/Magento/Quote/Model/Quote/TotalsCollector.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ class TotalsCollector
5353
protected $collectorList;
5454

5555
/**
56-
* Quote validator
57-
*
5856
* @var \Magento\Quote\Model\QuoteValidator
5957
*/
6058
protected $quoteValidator;

app/code/Magento/SalesRule/Model/RulesApplier.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
/**
2020
* Rule applier model
21+
*
22+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2123
*/
2224
class RulesApplier
2325
{

app/code/Magento/Tax/Model/ResourceModel/Calculation.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,14 @@ class Calculation extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
1414
/**
1515
* Store ISO 3166-1 alpha-2 USA country code
1616
*/
17-
const USA_COUNTRY_CODE = 'US';
17+
public const USA_COUNTRY_CODE = 'US';
1818

1919
/**
20-
* Rates cache
21-
*
2220
* @var array
2321
*/
2422
protected $_ratesCache = [];
2523

2624
/**
27-
* Tax data
28-
*
2925
* @var \Magento\Tax\Helper\Data
3026
*/
3127
protected $_taxData;
@@ -254,8 +250,9 @@ protected function _createSearchPostCodeTemplates($postcode, $exactPostcode = nu
254250
}
255251

256252
/**
257-
* Returns tax rates for request - either pereforms SELECT from DB, or returns already cached result
258-
* Notice that productClassId due to optimization can be array of ids
253+
* Returns tax rates for request - either pereforms SELECT from DB, or returns already cached result.
254+
*
255+
* Notice that productClassId due to optimization can be array of ids.
259256
*
260257
* @param \Magento\Framework\DataObject $request
261258
* @return array
@@ -342,6 +339,8 @@ protected function _getRates($request)
342339
$postcodeIsNumeric = is_numeric($postcode);
343340
$postcodeIsRange = false;
344341
$originalPostcode = null;
342+
$zipFrom = null;
343+
$zipTo = null;
345344
if (is_string($postcode) && preg_match('/^(.+)-(.+)$/', $postcode, $matches)) {
346345
if ($countryId == self::USA_COUNTRY_CODE && is_numeric($matches[2]) && strlen($matches[2]) == 4) {
347346
$postcodeIsNumeric = true;
@@ -354,6 +353,7 @@ protected function _getRates($request)
354353
}
355354
}
356355

356+
$selectClone = null;
357357
if ($postcodeIsNumeric || $postcodeIsRange) {
358358
$selectClone = clone $select;
359359
$selectClone->where('rate.zip_is_range IS NOT NULL');

lib/internal/Magento/Framework/Reflection/TypeProcessor.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@ class TypeProcessor
2727
/**#@+
2828
* Pre-normalized type constants
2929
*/
30-
const STRING_TYPE = 'str';
31-
const INT_TYPE = 'integer';
32-
const BOOLEAN_TYPE = 'bool';
33-
const ANY_TYPE = 'mixed';
30+
public const STRING_TYPE = 'str';
31+
public const INT_TYPE = 'integer';
32+
public const BOOLEAN_TYPE = 'bool';
33+
public const ANY_TYPE = 'mixed';
3434
/**#@-*/
3535

3636
/**#@+
3737
* Normalized type constants
3838
*/
39-
const NORMALIZED_STRING_TYPE = 'string';
40-
const NORMALIZED_INT_TYPE = 'int';
41-
const NORMALIZED_FLOAT_TYPE = 'float';
42-
const NORMALIZED_DOUBLE_TYPE = 'double';
43-
const NORMALIZED_BOOLEAN_TYPE = 'boolean';
44-
const NORMALIZED_ANY_TYPE = 'anyType';
39+
public const NORMALIZED_STRING_TYPE = 'string';
40+
public const NORMALIZED_INT_TYPE = 'int';
41+
public const NORMALIZED_FLOAT_TYPE = 'float';
42+
public const NORMALIZED_DOUBLE_TYPE = 'double';
43+
public const NORMALIZED_BOOLEAN_TYPE = 'boolean';
44+
public const NORMALIZED_ANY_TYPE = 'anyType';
4545
/**#@-*/
4646

4747
/**
@@ -857,6 +857,7 @@ private function getMethodReturnAnnotation(MethodReflection $methodReflection)
857857
$methodName = $methodReflection->getName();
858858
$returnAnnotations = $this->getReturnFromDocBlock($methodReflection);
859859

860+
// @phpstan-ignore-next-line as $returnAnnotations can be empty
860861
if (empty($returnAnnotations)) {
861862
$classReflection = $methodReflection->getDeclaringClass();
862863
// method can inherit doc block from implemented interface, like for interceptors
@@ -871,6 +872,7 @@ private function getMethodReturnAnnotation(MethodReflection $methodReflection)
871872
}
872873
}
873874

875+
// @phpstan-ignore-next-line as $returnAnnotations can be empty
874876
if (empty($returnAnnotations)) {
875877
while ($classReflection->getParentClass()) {
876878
$classReflection = $classReflection->getParentClass();
@@ -883,6 +885,7 @@ private function getMethodReturnAnnotation(MethodReflection $methodReflection)
883885
}
884886

885887
// throw an exception if even implemented interface doesn't have return annotations
888+
// @phpstan-ignore-next-line as $returnAnnotations can be empty
886889
if (empty($returnAnnotations)) {
887890
throw new \InvalidArgumentException(
888891
"Method's return type must be specified using @return annotation. "

0 commit comments

Comments
 (0)