Skip to content

Commit 013fa70

Browse files
author
silinmykola
committed
fixes after CR
1 parent 92c4490 commit 013fa70

File tree

8 files changed

+39
-37
lines changed

8 files changed

+39
-37
lines changed

app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ public function __construct(
5959
$this->_productIndexerHelper = $productIndexerHelper;
6060
$this->resource = $resource;
6161
$this->_connection = $resource->getConnection();
62-
$this->tableBuilderFactory = $tableBuilderFactory ?: ObjectManager::getInstance()
62+
$this->tableBuilderFactory = $tableBuilderFactory ?? ObjectManager::getInstance()
6363
->get(BuilderInterfaceFactory::class);
64-
$this->metadataPool = $metadataPool ?: ObjectManager::getInstance()->get(MetadataPool::class);
64+
$this->metadataPool = $metadataPool ?? ObjectManager::getInstance()->get(MetadataPool::class);
6565
}
6666

6767
/**

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,8 @@ public function is24hTimeFormat()
340340
*/
341341
public function getYearStart()
342342
{
343-
$_range = explode(',', $this->getConfigData('year_range') ?? '');
343+
$_range = $this->getConfigData('year_range') !== null
344+
? explode(',', $this->getConfigData('year_range')) : [];
344345
if (isset($_range[0]) && !empty($_range[0])) {
345346
return $_range[0];
346347
} else {
@@ -355,7 +356,8 @@ public function getYearStart()
355356
*/
356357
public function getYearEnd()
357358
{
358-
$_range = explode(',', $this->getConfigData('year_range') ?? '');
359+
$_range = $this->getConfigData('year_range')
360+
? explode(',', $this->getConfigData('year_range')) : [];
359361
if (isset($_range[1]) && !empty($_range[1])) {
360362
return $_range[1];
361363
} else {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function validateUserValue($values)
5858
parent::validateUserValue($values);
5959

6060
$option = $this->getOption();
61-
$value = ($this->getUserValue() !== null) ? trim($this->getUserValue()) : '';
61+
$value = $this->getUserValue() !== null ? trim($this->getUserValue()) : '';
6262

6363
// Check requires option to have some value
6464
if (strlen($value) == 0 && $option->getIsRequire() && !$this->getSkipCheckRequiredOption()) {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ public function build(ProductAttributeInterface $attribute, array $data)
3333
$rules['validate-zero-or-greater'] = true;
3434
}
3535

36-
$validationClasses = explode(' ', $attribute->getFrontendClass() ?? '');
36+
$validationClasses = $attribute->getFrontendClass()
37+
? explode(' ', $attribute->getFrontendClass()) : [];
3738

3839
foreach ($validationClasses as $class) {
3940
if (preg_match('/^maximum-length-(\d+)$/', $class, $matches)) {

app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,32 +31,32 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
3131
/**
3232
* Custom option column names
3333
*/
34-
const COLUMN_SKU = 'sku';
34+
public const COLUMN_SKU = 'sku';
3535

36-
const COLUMN_PREFIX = '_custom_option_';
36+
public const COLUMN_PREFIX = '_custom_option_';
3737

38-
const COLUMN_STORE = '_custom_option_store';
38+
public const COLUMN_STORE = '_custom_option_store';
3939

40-
const COLUMN_TYPE = '_custom_option_type';
40+
public const COLUMN_TYPE = '_custom_option_type';
4141

42-
const COLUMN_TITLE = '_custom_option_title';
42+
public const COLUMN_TITLE = '_custom_option_title';
4343

44-
const COLUMN_IS_REQUIRED = '_custom_option_is_required';
44+
public const COLUMN_IS_REQUIRED = '_custom_option_is_required';
4545

46-
const COLUMN_SORT_ORDER = '_custom_option_sort_order';
46+
public const COLUMN_SORT_ORDER = '_custom_option_sort_order';
4747

48-
const COLUMN_ROW_TITLE = '_custom_option_row_title';
48+
public const COLUMN_ROW_TITLE = '_custom_option_row_title';
4949

50-
const COLUMN_ROW_PRICE = '_custom_option_row_price';
50+
public const COLUMN_ROW_PRICE = '_custom_option_row_price';
5151

52-
const COLUMN_ROW_SKU = '_custom_option_row_sku';
52+
public const COLUMN_ROW_SKU = '_custom_option_row_sku';
5353

54-
const COLUMN_ROW_SORT = '_custom_option_row_sort';
54+
public const COLUMN_ROW_SORT = '_custom_option_row_sort';
5555

5656
/**
5757
* XML path to page size parameter
5858
*/
59-
const XML_PATH_PAGE_SIZE = 'import/format_v1/page_size';
59+
public const XML_PATH_PAGE_SIZE = 'import/format_v1/page_size';
6060

6161
/**
6262
* @var string
@@ -1279,9 +1279,8 @@ protected function _importData()
12791279
$multiRowData = $this->_getMultiRowFormat($rowData);
12801280
if (!empty($rowData[self::COLUMN_SKU]) && isset($this->_productsSkuToId[$rowData[self::COLUMN_SKU]])) {
12811281
$this->_rowProductId = $this->_productsSkuToId[$rowData[self::COLUMN_SKU]];
1282-
if (array_key_exists('custom_options', $rowData)
1282+
if (isset($rowData['custom_options'])
12831283
&& (
1284-
$rowData['custom_options'] === null ||
12851284
trim($rowData['custom_options']) === '' ||
12861285
trim($rowData['custom_options']) === $this->_productEntity->getEmptyAttributeValueConstant()
12871286
)

app/code/Magento/Checkout/view/frontend/templates/cart/coupon.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010

1111
// We should use strlen function because coupon code could be "0", converted to bool will lead to false
12-
$hasCouponCode = (bool) ($block->getCouponCode() ? strlen($block->getCouponCode()) : '');
12+
$hasCouponCode = $block->getCouponCode() !== null && strlen($block->getCouponCode()) > 0;
1313
?>
1414
<div class="block discount"
1515
id="block-discount"

app/code/Magento/CustomerImportExport/Model/Import/Address.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,48 +25,48 @@
2525
class Address extends AbstractCustomer
2626
{
2727
/**
28-
* Customer Address EAV additional attribute collection name
28+
* The customer address attribute collection class name
2929
*/
30-
const ATTRIBUTE_COLLECTION_NAME = \Magento\Customer\Model\ResourceModel\Address\Attribute\Collection::class;
30+
public const ATTRIBUTE_COLLECTION_NAME = \Magento\Customer\Model\ResourceModel\Address\Attribute\Collection::class;
3131

3232
/**
3333
* Permanent column names
3434
*
3535
* Names that begins with underscore is not an attribute.
3636
* This name convention is for to avoid interference with same attribute name.
3737
*/
38-
const COLUMN_EMAIL = '_email';
38+
public const COLUMN_EMAIL = '_email';
3939

40-
const COLUMN_ADDRESS_ID = '_entity_id';
40+
public const COLUMN_ADDRESS_ID = '_entity_id';
4141

4242
/**
4343
* Required column names
4444
*/
45-
const COLUMN_REGION = 'region';
45+
public const COLUMN_REGION = 'region';
4646

47-
const COLUMN_COUNTRY_ID = 'country_id';
47+
public const COLUMN_COUNTRY_ID = 'country_id';
4848

49-
const COLUMN_POSTCODE = 'postcode';
49+
public const COLUMN_POSTCODE = 'postcode';
5050

51-
const COLUMN_REGION_ID = 'region_id';
51+
public const COLUMN_REGION_ID = 'region_id';
5252

5353
/**
5454
* Particular columns that contains of customer default addresses
5555
*/
56-
const COLUMN_DEFAULT_BILLING = '_address_default_billing_';
56+
public const COLUMN_DEFAULT_BILLING = '_address_default_billing_';
5757

58-
const COLUMN_DEFAULT_SHIPPING = '_address_default_shipping_';
58+
public const COLUMN_DEFAULT_SHIPPING = '_address_default_shipping_';
5959

6060
/**
6161
* Error codes
6262
*/
63-
const ERROR_ADDRESS_ID_IS_EMPTY = 'addressIdIsEmpty';
63+
public const ERROR_ADDRESS_ID_IS_EMPTY = 'addressIdIsEmpty';
6464

65-
const ERROR_ADDRESS_NOT_FOUND = 'addressNotFound';
65+
public const ERROR_ADDRESS_NOT_FOUND = 'addressNotFound';
6666

67-
const ERROR_INVALID_REGION = 'invalidRegion';
67+
public const ERROR_INVALID_REGION = 'invalidRegion';
6868

69-
const ERROR_DUPLICATE_PK = 'duplicateAddressId';
69+
public const ERROR_DUPLICATE_PK = 'duplicateAddressId';
7070

7171
/**
7272
* @var string[]

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
class RateRepository implements \Magento\Tax\Api\TaxRateRepositoryInterface
2323
{
24-
const MESSAGE_TAX_RATE_ID_IS_NOT_ALLOWED = 'id is not expected for this request.';
24+
public const MESSAGE_TAX_RATE_ID_IS_NOT_ALLOWED = 'id is not expected for this request.';
2525

2626
/**
2727
* Tax rate model and tax rate data object converter
@@ -102,7 +102,7 @@ public function __construct(
102102
$this->regionFactory = $regionFactory;
103103
$this->resourceModel = $rateResource;
104104
$this->joinProcessor = $joinProcessor;
105-
$this->collectionProcessor = $collectionProcessor ?: \Magento\Framework\App\ObjectManager::getInstance()->get(
105+
$this->collectionProcessor = $collectionProcessor ?? \Magento\Framework\App\ObjectManager::getInstance()->get(
106106
// phpstan:ignore "Class Magento\Tax\Model\Api\SearchCriteria\TaxRateCollectionProcessor not found."
107107
\Magento\Tax\Model\Api\SearchCriteria\TaxRateCollectionProcessor::class
108108
);

0 commit comments

Comments
 (0)