Skip to content

Commit 2f9293f

Browse files
author
silinmykola
committed
fixes after a code review
1 parent d9ffd49 commit 2f9293f

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

app/code/Magento/Catalog/Model/Product/Option/Type/Date.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ public function getYearStart()
356356
*/
357357
public function getYearEnd()
358358
{
359-
$_range = $this->getConfigData('year_range')
359+
$_range = $this->getConfigData('year_range') !== null
360360
? explode(',', $this->getConfigData('year_range')) : [];
361361
if (isset($_range[1]) && !empty($_range[1])) {
362362
return $_range[1];

app/code/Magento/Catalog/Ui/DataProvider/CatalogEavValidationRules.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,11 @@ public function build(ProductAttributeInterface $attribute, array $data)
3838

3939
foreach ($validationClasses as $class) {
4040
if (preg_match('/^maximum-length-(\d+)$/', $class, $matches)) {
41-
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
42-
$rules = array_merge($rules, ['max_text_length' => $matches[1]]);
41+
$rules['max_text_length'] = $matches[1];
4342
continue;
4443
}
4544
if (preg_match('/^minimum-length-(\d+)$/', $class, $matches)) {
46-
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
47-
$rules = array_merge($rules, ['min_text_length' => $matches[1]]);
45+
$rules['min_text_length'] = $matches[1];
4846
continue;
4947
}
5048

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ public function __construct(
103103
$this->resourceModel = $rateResource;
104104
$this->joinProcessor = $joinProcessor;
105105
$this->collectionProcessor = $collectionProcessor ?? \Magento\Framework\App\ObjectManager::getInstance()->get(
106-
// phpstan:ignore "Class Magento\Tax\Model\Api\SearchCriteria\TaxRateCollectionProcessor not found."
107-
\Magento\Tax\Model\Api\SearchCriteria\TaxRateCollectionProcessor::class
106+
'Magento\Tax\Model\Api\SearchCriteria\TaxRateCollectionProcessor'
108107
);
109108
}
110109

@@ -273,7 +272,9 @@ private function validate(\Magento\Tax\Api\Data\TaxRateInterface $taxRate)
273272
);
274273
}
275274

276-
if (!\Zend_Validate::is(trim($taxRate->getCode() ?? ''), 'NotEmpty')) {
275+
if ($taxRate->getCode() !== null
276+
|| !\Zend_Validate::is(trim($taxRate->getCode()), 'NotEmpty')
277+
) {
277278
$exception->addError(__('"%fieldName" is required. Enter and try again.', ['fieldName' => 'code']));
278279
}
279280

@@ -296,8 +297,12 @@ private function validate(\Magento\Tax\Api\Data\TaxRateInterface $taxRate)
296297
$exception->addError(__('Range To should be equal or greater than Range From.'));
297298
}
298299
} else {
299-
if (!\Zend_Validate::is(trim($taxRate->getTaxPostcode() ?? ''), 'NotEmpty')) {
300-
$exception->addError(__('"%fieldName" is required. Enter and try again.', ['fieldName' => 'postcode']));
300+
if ($taxRate->getTaxPostcode() !== null
301+
|| !\Zend_Validate::is(trim($taxRate->getTaxPostcode()), 'NotEmpty')
302+
) {
303+
$exception->addError(
304+
__('"%fieldName" is required. Enter and try again.', ['fieldName' => 'postcode'])
305+
);
301306
}
302307
}
303308

app/code/Magento/Tax/Model/Calculation/Rule/Validator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function isValid($value)
7373
}
7474

7575
// Code is required
76-
if (!\Zend_Validate::is(trim($value->getCode() ?? ''), 'NotEmpty')) {
76+
if ($value->getCode() !== null || !\Zend_Validate::is(trim($value->getCode()), 'NotEmpty')) {
7777
$this->addErrorMessage(
7878
$messages,
7979
'"%fieldName" is required. Enter and try again.',

setup/src/Magento/Setup/Test/Unit/Module/Setup/SetupCacheTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function testGetNonexistent($field)
6060
public function getNonexistentDataProvider()
6161
{
6262
return [
63-
[''],
63+
[null],
6464
['field'],
6565
];
6666
}

0 commit comments

Comments
 (0)