Skip to content

Commit d0823b7

Browse files
authored
ENGCOM-3980: Assign with and, or, replaced by &&, || #20628
2 parents 0db5e07 + d48965c commit d0823b7

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
@@ -163,7 +163,7 @@ private function isUniqueAdminValues(array $optionsValues, array $deletedOptions
163163
{
164164
$adminValues = [];
165165
foreach ($optionsValues as $optionKey => $values) {
166-
if (!(isset($deletedOptions[$optionKey]) and $deletedOptions[$optionKey] === '1')) {
166+
if (!(isset($deletedOptions[$optionKey]) && $deletedOptions[$optionKey] === '1')) {
167167
$adminValues[] = reset($values);
168168
}
169169
}

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

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

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

@@ -107,6 +107,8 @@ public function execute()
107107
}
108108

109109
/**
110+
* Get error response.
111+
*
110112
* @return Json
111113
*/
112114
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
@@ -48,13 +48,13 @@ public function __construct(
4848
}
4949

5050
/**
51-
* {@inheritdoc}
51+
* @inheritdoc
5252
*/
5353
public function check($securityEventType, $accountReference = null, $longIp = null)
5454
{
5555
$isEnabled = $this->securityConfig->getPasswordResetProtectionType() != ResetMethod::OPTION_NONE;
5656
$allowedAttemptsNumber = $this->securityConfig->getMaxNumberPasswordResetRequests();
57-
if ($isEnabled and $allowedAttemptsNumber) {
57+
if ($isEnabled && $allowedAttemptsNumber) {
5858
$collection = $this->prepareCollection($securityEventType, $accountReference, $longIp);
5959
if ($collection->count() >= $allowedAttemptsNumber) {
6060
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
@@ -265,7 +265,7 @@ protected function processExtraTaxables(Address\Total $total, array $itemsByType
265265
{
266266
$extraTaxableDetails = [];
267267
foreach ($itemsByType as $itemType => $itemTaxDetails) {
268-
if ($itemType != self::ITEM_TYPE_PRODUCT and $itemType != self::ITEM_TYPE_SHIPPING) {
268+
if ($itemType != self::ITEM_TYPE_PRODUCT && $itemType != self::ITEM_TYPE_SHIPPING) {
269269
foreach ($itemTaxDetails as $itemCode => $itemTaxDetail) {
270270
/** @var \Magento\Tax\Api\Data\TaxDetailsInterface $taxDetails */
271271
$taxDetails = $itemTaxDetail[self::KEY_ITEM];
@@ -408,6 +408,7 @@ protected function enhanceTotalData(
408408

409409
/**
410410
* Process model configuration array.
411+
*
411412
* This method can be used for changing totals collect sort order
412413
*
413414
* @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
@@ -194,7 +194,7 @@ private function assertClassesExist(array $classes, string $path): void
194194
foreach ($classes as $class) {
195195
$class = trim($class, '\\');
196196
try {
197-
if (strrchr($class, '\\') === false and !Classes::isVirtual($class)) {
197+
if (strrchr($class, '\\') === false && !Classes::isVirtual($class)) {
198198
$badUsages[] = $class;
199199
continue;
200200
} else {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ public function templateDirective($construction)
293293
{
294294
// Processing of {template config_path=... [...]} statement
295295
$templateParameters = $this->getParameters($construction[2]);
296-
if (!isset($templateParameters['config_path']) or !$this->getTemplateProcessor()) {
296+
if (!isset($templateParameters['config_path']) || !$this->getTemplateProcessor()) {
297297
// Not specified template or not set include processor
298298
$replacedValue = '{Error in template processing}';
299299
} 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
@@ -139,7 +139,7 @@ class Session implements ConfigOptionsListInterface
139139
];
140140

141141
/**
142-
* {@inheritdoc}
142+
* @inheritdoc
143143
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
144144
*/
145145
public function getOptions()
@@ -289,7 +289,7 @@ public function getOptions()
289289
}
290290

291291
/**
292-
* {@inheritdoc}
292+
* @inheritdoc
293293
*/
294294
public function createConfig(array $options, DeploymentConfig $deploymentConfig)
295295
{
@@ -320,7 +320,7 @@ public function createConfig(array $options, DeploymentConfig $deploymentConfig)
320320
}
321321

322322
/**
323-
* {@inheritdoc}
323+
* @inheritdoc
324324
*/
325325
public function validate(array $options, DeploymentConfig $deploymentConfig)
326326
{
@@ -340,7 +340,7 @@ public function validate(array $options, DeploymentConfig $deploymentConfig)
340340

341341
if (isset($options[self::INPUT_KEY_SESSION_REDIS_LOG_LEVEL])) {
342342
$level = $options[self::INPUT_KEY_SESSION_REDIS_LOG_LEVEL];
343-
if (($level < 0) or ($level > 7)) {
343+
if (($level < 0) || ($level > 7)) {
344344
$errors[] = "Invalid Redis log level '{$level}'. Valid range is 0-7, inclusive.";
345345
}
346346
}

0 commit comments

Comments
 (0)