Skip to content

Commit 565ef27

Browse files
Merge branch 'magento-commerce:2.4-develop' into L3-PR-20211001
2 parents 3558ac8 + ca1b5b6 commit 565ef27

File tree

45 files changed

+237
-149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+237
-149
lines changed

app/code/Magento/Backend/Block/Widget/Grid/Column.php

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Backend\Block\Widget\Grid;
78

89
use Magento\Backend\Block\Widget;
@@ -46,7 +47,7 @@ class Column extends Widget
4647
protected $_cssClass = null;
4748

4849
/**
49-
* Renderer types
50+
* The renderer types
5051
*
5152
* @var array
5253
*/
@@ -74,7 +75,7 @@ class Column extends Widget
7475
];
7576

7677
/**
77-
* Filter types
78+
* The filter types
7879
*
7980
* @var array
8081
*/
@@ -103,6 +104,8 @@ class Column extends Widget
103104
protected $_isGrouped = false;
104105

105106
/**
107+
* Set property is grouped.
108+
*
106109
* @return void
107110
*/
108111
public function _construct()
@@ -169,7 +172,8 @@ public function getHtmlProperty()
169172
}
170173

171174
/**
172-
* Get Header html
175+
* This method get Header html.
176+
*
173177
* @return string
174178
*/
175179
public function getHeaderHtml()
@@ -222,7 +226,8 @@ public function setSortable($value)
222226
}
223227

224228
/**
225-
* Get header css class name
229+
* Get header css class name.
230+
*
226231
* @return string
227232
*/
228233
public function getHeaderCssClass()
@@ -234,6 +239,8 @@ public function getHeaderCssClass()
234239
}
235240

236241
/**
242+
* This method check if is sortable.
243+
*
237244
* @return bool
238245
* @SuppressWarnings(PHPMD.BooleanGetMethodName)
239246
*/
@@ -256,6 +263,7 @@ public function addHeaderCssClass($className)
256263

257264
/**
258265
* Get header class names
266+
*
259267
* @return string
260268
*/
261269
public function getHeaderHtmlProperty()
@@ -291,6 +299,7 @@ public function getRowField(\Magento\Framework\DataObject $row)
291299
$frameCallback = $this->getFrameCallback();
292300
if (is_array($frameCallback)) {
293301
$this->validateFrameCallback($frameCallback);
302+
//phpcs:ignore Magento2.Functions.DiscouragedFunction
294303
$renderedValue = call_user_func($frameCallback, $renderedValue, $row, $this, false);
295304
}
296305

@@ -334,6 +343,7 @@ public function getRowFieldExport(\Magento\Framework\DataObject $row)
334343
$frameCallback = $this->getFrameCallback();
335344
if (is_array($frameCallback)) {
336345
$this->validateFrameCallback($frameCallback);
346+
//phpcs:ignore Magento2.Functions.DiscouragedFunction
337347
$renderedValue = call_user_func($frameCallback, $renderedValue, $row, $this, true);
338348
}
339349

@@ -412,12 +422,8 @@ public function setRendererType($type, $className)
412422
*/
413423
protected function _getRendererByType()
414424
{
415-
$type = strtolower($this->getType());
416-
$rendererClass = isset(
417-
$this->_rendererTypes[$type]
418-
) ? $this->_rendererTypes[$type] : $this->_rendererTypes['default'];
419-
420-
return $rendererClass;
425+
$type = strtolower((string) $this->getType());
426+
return $this->_rendererTypes[$type] ?? $this->_rendererTypes['default'];
421427
}
422428

423429
/**
@@ -469,10 +475,8 @@ public function setFilterType($type, $className)
469475
*/
470476
protected function _getFilterByType()
471477
{
472-
$type = $this->getFilterType() ? strtolower($this->getFilterType()) : strtolower($this->getType());
473-
$filterClass = isset($this->_filterTypes[$type]) ? $this->_filterTypes[$type] : $this->_filterTypes['default'];
474-
475-
return $filterClass;
478+
$type = $this->getFilterType() ? strtolower($this->getFilterType()) : strtolower((string) $this->getType());
479+
return $this->_filterTypes[$type] ?? $this->_filterTypes['default'];
476480
}
477481

478482
/**

app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ protected function _convertDate($date)
233233
\IntlDateFormatter::NONE,
234234
$adminTimeZone
235235
);
236-
$simpleRes = new \DateTime(null, $adminTimeZone);
236+
$simpleRes = new \DateTime('now', $adminTimeZone);
237237
$simpleRes->setTimestamp($formatter->parse($date));
238238
$simpleRes->setTime(0, 0, 0);
239239
$simpleRes->setTimezone(new \DateTimeZone('UTC'));

app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Concat.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ public function render(\Magento\Framework\DataObject $row)
3030
&& is_callable([$row, $method])
3131
&& substr_compare('get', $method, 1, 3) !== 0
3232
) {
33+
//phpcs:ignore Magento2.Functions.DiscouragedFunction
3334
$data = call_user_func([$row, $method]);
3435
} else {
3536
$data = $row->getData($method);
3637
}
37-
if (strlen($data) > 0) {
38+
if (strlen((string) $data) > 0) {
3839
$dataArr[] = $data;
3940
}
4041
}

app/code/Magento/Bundle/Model/Option/Validator.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ public function __construct(NotEmptyFactory $notEmptyFactory)
2626
}
2727

2828
/**
29+
* This method check is valid value.
30+
*
2931
* @param \Magento\Bundle\Model\Option $value
32+
*
3033
* @return boolean
3134
* @throws Zend_Validate_Exception If validation of $value is impossible
3235
*/
@@ -38,10 +41,12 @@ public function isValid($value)
3841
}
3942

4043
/**
44+
* This method validate required fields.
45+
*
4146
* @param \Magento\Bundle\Model\Option $value
47+
*
4248
* @return void
43-
* @throws Zend_Validate_Exception
44-
* @throws \Exception
49+
* @throws \Exception|Zend_Validate_Exception
4550
*/
4651
protected function validateRequiredFields($value)
4752
{
@@ -51,7 +56,7 @@ protected function validateRequiredFields($value)
5156
'type' => $value->getType()
5257
];
5358
foreach ($requiredFields as $requiredField => $requiredValue) {
54-
if (!$this->notEmpty->isValid(trim($requiredValue))) {
59+
if (!$this->notEmpty->isValid(trim((string) $requiredValue))) {
5560
$messages[$requiredField] =
5661
__('"%fieldName" is required. Enter and try again.', ['fieldName' => $requiredField]);
5762
}

app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1850,7 +1850,7 @@ private function reInitModel(): void
18501850
->getMockForAbstractClass();
18511851

18521852
$dateTime = '2017-10-25 18:57:08';
1853-
$timestamp = '1508983028';
1853+
$timestamp = 1508983028;
18541854
$dateTimeMock = $this->getMockBuilder(\DateTime::class)
18551855
->disableOriginalConstructor()
18561856
->onlyMethods(['format', 'getTimestamp', 'setTimestamp'])
@@ -2363,7 +2363,7 @@ public function testCreateAccountWithPasswordHashWithCustomerAddresses(): void
23632363
private function prepareDateTimeFactory(): string
23642364
{
23652365
$dateTime = '2017-10-25 18:57:08';
2366-
$timestamp = '1508983028';
2366+
$timestamp = 1508983028;
23672367
$dateTimeMock = $this->createMock(\DateTime::class);
23682368
$dateTimeMock->expects($this->any())
23692369
->method('format')

app/code/Magento/Paypal/Model/Express.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ protected function _isTransactionExpired(Transaction $transaction, $period)
843843
$transactionClosingDate->setTime(11, 49, 00);
844844
$transactionClosingDate->modify('+' . $period . ' days');
845845

846-
$currentTime = new \DateTime(null, new \DateTimeZone('US/Pacific'));
846+
$currentTime = new \DateTime('now', new \DateTimeZone('US/Pacific'));
847847

848848
if ($currentTime > $transactionClosingDate) {
849849
return true;

app/code/Magento/Reports/Model/ResourceModel/Order/Collection.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,27 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Reports\Model\ResourceModel\Order;
78

89
use Magento\Framework\DB\Select;
910

1011
/**
1112
* Reports orders collection
1213
*
13-
* @author Magento Core Team <[email protected]>
1414
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1515
* @api
1616
* @since 100.0.2
1717
*/
1818
class Collection extends \Magento\Sales\Model\ResourceModel\Order\Collection
1919
{
2020
/**
21-
* Is live
22-
*
2321
* @var bool
2422
*/
2523
protected $_isLive = false;
2624

2725
/**
28-
* Sales amount expression
26+
* The sales amount expression
2927
*
3028
* @var string
3129
*/
@@ -352,7 +350,7 @@ protected function _getRangeExpression($range)
352350
protected function _getRangeExpressionForAttribute($range, $attribute)
353351
{
354352
$expression = $this->_getRangeExpression($range);
355-
return str_replace('{{attribute}}', $this->getConnection()->quoteIdentifier($attribute), $expression);
353+
return str_replace('{{attribute}}', $this->getConnection()->quoteIdentifier($attribute), (string) $expression);
356354
}
357355

358356
/**
@@ -369,7 +367,7 @@ protected function _getTZRangeOffsetExpression($range, $attribute, $from = null,
369367
return str_replace(
370368
'{{attribute}}',
371369
$this->_reportOrderFactory->create()->getStoreTZOffsetQuery($this->getMainTable(), $attribute, $from, $to),
372-
$this->_getRangeExpression($range)
370+
(string) $this->_getRangeExpression($range)
373371
);
374372
}
375373

app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Order/CollectionTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,11 @@ public function testPrepareSummary($useAggregatedData, $mainTable, $isFilter, $g
261261
->expects($getIfNullSqlResult)
262262
->method('getIfNullSql');
263263

264+
$this->connectionMock->expects($this->once())
265+
->method('getDateFormatSql')
266+
->with('{{attribute}}', '%Y-%m')
267+
->willReturn(new \Zend_Db_Expr('DATE_FORMAT(%2021-%10, %Y-%m)'));
268+
264269
$this->collection->prepareSummary($range, $customStart, $customEnd, $isFilter);
265270
}
266271

app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ public function validate(\Magento\Framework\Model\AbstractModel $model)
546546
$attr = $model->getResource()->getAttribute($attrCode);
547547

548548
if ($attr && $attr->getBackendType() == 'datetime' && !is_int($this->getValue())) {
549-
$this->setValue(strtotime($this->getValue()));
549+
$this->setValue(strtotime((string) $this->getValue()));
550550
$value = strtotime($model->getData($attrCode));
551551
return $this->validateAttribute($value);
552552
}

app/code/Magento/Rule/Model/Condition/Sql/Builder.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,21 @@ protected function _getMappedSqlCondition(
173173
) {
174174
$sql = str_replace(
175175
':field',
176-
$this->_connection->getIfNullSql($this->_connection->quoteIdentifier($argument), $defaultValue),
176+
(string) $this->_connection->getIfNullSql(
177+
$this->_connection->quoteIdentifier($argument),
178+
$defaultValue
179+
),
177180
$this->stringConditionOperatorMap[$conditionOperator]
178181
);
179182
$bindValue = $condition->getBindArgumentValue();
180183
$expression = $value . $this->_connection->quoteInto($sql, "%$bindValue%");
181184
} else {
182185
$sql = str_replace(
183186
':field',
184-
$this->_connection->getIfNullSql($this->_connection->quoteIdentifier($argument), $defaultValue),
187+
(string) $this->_connection->getIfNullSql(
188+
$this->_connection->quoteIdentifier($argument),
189+
$defaultValue
190+
),
185191
$this->_conditionOperatorMap[$conditionOperator]
186192
);
187193
$bindValue = $condition->getBindArgumentValue();

app/code/Magento/Shipping/Model/Simplexml/Element.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Shipping\Model\Simplexml;
78

89
/**
@@ -21,9 +22,7 @@ class Element extends \Magento\Framework\Simplexml\Element
2122
*/
2223
public function addAttribute($name, $value = null, $namespace = null)
2324
{
24-
if ($value !== null) {
25-
$value = $this->xmlentities($value);
26-
}
25+
$value = $value !== null ? $this->xmlentities($value) : '';
2726
parent::addAttribute($name, $value, $namespace);
2827
}
2928

app/code/Magento/Usps/Model/Carrier.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C
109109
protected $_customizableContainerTypes = ['VARIABLE', 'RECTANGULAR', 'NONRECTANGULAR'];
110110

111111
/**
112-
* Carrier helper
112+
* The carrier helper
113113
*
114114
* @var \Magento\Shipping\Helper\Carrier
115115
*/
@@ -478,8 +478,8 @@ protected function _getXmlQuotes()
478478
$service = $r->getService();
479479
}
480480

481-
if (strpos($r->getContainer(), 'FLAT RATE ENVELOPE') !== false ||
482-
strpos($r->getContainer(), 'FLAT RATE BOX') !== false
481+
if ($r->getContainer() !== null && (strpos($r->getContainer(), 'FLAT RATE ENVELOPE') !== false ||
482+
strpos($r->getContainer(), 'FLAT RATE BOX') !== false)
483483
) {
484484
$service = 'Priority';
485485
}

app/code/Magento/Webapi/Model/Soap/Wsdl/ComplexTypeStrategy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public function addAnnotation(\DOMElement $element, $documentation, $default = n
222222
$appInfoNode->setAttributeNS(
223223
Wsdl::XML_NS_URI,
224224
Wsdl::XML_NS . ':' . self::APP_INF_NS,
225-
$this->getContext()->getTargetNamespace()
225+
(string) $this->getContext()->getTargetNamespace()
226226
);
227227

228228
$this->_processDefaultValueAnnotation($elementType, $default, $appInfoNode);

0 commit comments

Comments
 (0)