Skip to content

Commit bed498e

Browse files
authored
ENGCOM-4278: [Backport] Assign with and, or, replaced by &&, || #21247
2 parents 8402f8e + 16ddb40 commit bed498e

File tree

9 files changed

+26
-18
lines changed

9 files changed

+26
-18
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private function isUniqueAdminValues(array $optionsValues, array $deletedOptions
158158
{
159159
$adminValues = [];
160160
foreach ($optionsValues as $optionKey => $values) {
161-
if (!(isset($deletedOptions[$optionKey]) and $deletedOptions[$optionKey] === '1')) {
161+
if (!(isset($deletedOptions[$optionKey]) && $deletedOptions[$optionKey] === '1')) {
162162
$adminValues[] = reset($values);
163163
}
164164
}

app/code/Magento/Paypal/Controller/Transparent/RequestSecureToken.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function execute()
8282
/** @var Quote $quote */
8383
$quote = $this->sessionManager->getQuote();
8484

85-
if (!$quote or !$quote instanceof Quote) {
85+
if (!$quote || !$quote instanceof Quote) {
8686
return $this->getErrorResponse();
8787
}
8888

@@ -106,6 +106,8 @@ public function execute()
106106
}
107107

108108
/**
109+
* Get error response.
110+
*
109111
* @return Json
110112
*/
111113
private function getErrorResponse()

app/code/Magento/Security/Model/SecurityChecker/Quantity.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ public function __construct(
4747
}
4848

4949
/**
50-
* {@inheritdoc}
50+
* @inheritdoc
5151
*/
5252
public function check($securityEventType, $accountReference = null, $longIp = null)
5353
{
5454
$isEnabled = $this->securityConfig->getPasswordResetProtectionType() != ResetMethod::OPTION_NONE;
5555
$allowedAttemptsNumber = $this->securityConfig->getMaxNumberPasswordResetRequests();
56-
if ($isEnabled and $allowedAttemptsNumber) {
56+
if ($isEnabled && $allowedAttemptsNumber) {
5757
$collection = $this->prepareCollection($securityEventType, $accountReference, $longIp);
5858
if ($collection->count() >= $allowedAttemptsNumber) {
5959
throw new SecurityViolationException(

app/code/Magento/SendFriend/Model/SendFriend.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* @method \Magento\SendFriend\Model\SendFriend setTime(int $value)
1717
*
1818
* @author Magento Core Team <[email protected]>
19+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1920
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2021
*
2122
* @api
@@ -162,6 +163,8 @@ protected function _construct()
162163
}
163164

164165
/**
166+
* Send email.
167+
*
165168
* @return $this
166169
* @throws CoreException
167170
*/
@@ -236,7 +239,7 @@ public function validate()
236239
}
237240

238241
$email = $this->getSender()->getEmail();
239-
if (empty($email) or !\Zend_Validate::is($email, \Magento\Framework\Validator\EmailAddress::class)) {
242+
if (empty($email) || !\Zend_Validate::is($email, \Magento\Framework\Validator\EmailAddress::class)) {
240243
$errors[] = __('Invalid Sender Email');
241244
}
242245

@@ -281,13 +284,13 @@ public function setRecipients($recipients)
281284
// validate array
282285
if (!is_array(
283286
$recipients
284-
) or !isset(
287+
) || !isset(
285288
$recipients['email']
286-
) or !isset(
289+
) || !isset(
287290
$recipients['name']
288-
) or !is_array(
291+
) || !is_array(
289292
$recipients['email']
290-
) or !is_array(
293+
) || !is_array(
291294
$recipients['name']
292295
)
293296
) {
@@ -487,7 +490,7 @@ protected function _sentCountByCookies($increment = false)
487490
$oldTimes = explode(',', $oldTimes);
488491
foreach ($oldTimes as $oldTime) {
489492
$periodTime = $time - $this->_sendfriendData->getPeriod();
490-
if (is_numeric($oldTime) and $oldTime >= $periodTime) {
493+
if (is_numeric($oldTime) && $oldTime >= $periodTime) {
491494
$newTimes[] = $oldTime;
492495
}
493496
}

app/code/Magento/Tax/Model/Sales/Total/Quote/Tax.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ protected function processExtraTaxables(Address\Total $total, array $itemsByType
264264
{
265265
$extraTaxableDetails = [];
266266
foreach ($itemsByType as $itemType => $itemTaxDetails) {
267-
if ($itemType != self::ITEM_TYPE_PRODUCT and $itemType != self::ITEM_TYPE_SHIPPING) {
267+
if ($itemType != self::ITEM_TYPE_PRODUCT && $itemType != self::ITEM_TYPE_SHIPPING) {
268268
foreach ($itemTaxDetails as $itemCode => $itemTaxDetail) {
269269
/** @var \Magento\Tax\Api\Data\TaxDetailsInterface $taxDetails */
270270
$taxDetails = $itemTaxDetail[self::KEY_ITEM];
@@ -407,6 +407,7 @@ protected function enhanceTotalData(
407407

408408
/**
409409
* Process model configuration array.
410+
*
410411
* This method can be used for changing totals collect sort order
411412
*
412413
* @param array $config

dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ private function assertClassesExist($classes, $path)
191191
foreach ($classes as $class) {
192192
$class = trim($class, '\\');
193193
try {
194-
if (strrchr($class, '\\') === false and !Classes::isVirtual($class)) {
194+
if (strrchr($class, '\\') === false && !Classes::isVirtual($class)) {
195195
$badUsages[] = $class;
196196
continue;
197197
} else {

lib/internal/Magento/Framework/Filter/Template.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public function templateDirective($construction)
227227
{
228228
// Processing of {template config_path=... [...]} statement
229229
$templateParameters = $this->getParameters($construction[2]);
230-
if (!isset($templateParameters['config_path']) or !$this->getTemplateProcessor()) {
230+
if (!isset($templateParameters['config_path']) || !$this->getTemplateProcessor()) {
231231
// Not specified template or not set include processor
232232
$replacedValue = '{Error in template processing}';
233233
} else {

lib/internal/Magento/Framework/Message/Manager.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
/**
1313
* Message manager model
14+
*
15+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1416
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1517
*/
1618
class Manager implements ManagerInterface
@@ -226,7 +228,7 @@ public function addUniqueMessages(array $messages, $group = null)
226228
$items = $this->getMessages(false, $group)->getItems();
227229

228230
foreach ($messages as $message) {
229-
if ($message instanceof MessageInterface and !in_array($message, $items, false)) {
231+
if ($message instanceof MessageInterface && !in_array($message, $items, false)) {
230232
$this->addMessage($message, $group);
231233
}
232234
}

setup/src/Magento/Setup/Model/ConfigOptionsList/Session.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class Session implements ConfigOptionsListInterface
124124
];
125125

126126
/**
127-
* {@inheritdoc}
127+
* @inheritdoc
128128
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
129129
*/
130130
public function getOptions()
@@ -250,7 +250,7 @@ public function getOptions()
250250
}
251251

252252
/**
253-
* {@inheritdoc}
253+
* @inheritdoc
254254
*/
255255
public function createConfig(array $options, DeploymentConfig $deploymentConfig)
256256
{
@@ -281,7 +281,7 @@ public function createConfig(array $options, DeploymentConfig $deploymentConfig)
281281
}
282282

283283
/**
284-
* {@inheritdoc}
284+
* @inheritdoc
285285
*/
286286
public function validate(array $options, DeploymentConfig $deploymentConfig)
287287
{
@@ -301,7 +301,7 @@ public function validate(array $options, DeploymentConfig $deploymentConfig)
301301

302302
if (isset($options[self::INPUT_KEY_SESSION_REDIS_LOG_LEVEL])) {
303303
$level = $options[self::INPUT_KEY_SESSION_REDIS_LOG_LEVEL];
304-
if (($level < 0) or ($level > 7)) {
304+
if (($level < 0) || ($level > 7)) {
305305
$errors[] = "Invalid Redis log level '{$level}'. Valid range is 0-7, inclusive.";
306306
}
307307
}

0 commit comments

Comments
 (0)