Skip to content

[Backport] Assign with and, or, replaced by &&, || #21247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private function isUniqueAdminValues(array $optionsValues, array $deletedOptions
{
$adminValues = [];
foreach ($optionsValues as $optionKey => $values) {
if (!(isset($deletedOptions[$optionKey]) and $deletedOptions[$optionKey] === '1')) {
if (!(isset($deletedOptions[$optionKey]) && $deletedOptions[$optionKey] === '1')) {
$adminValues[] = reset($values);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function execute()
/** @var Quote $quote */
$quote = $this->sessionManager->getQuote();

if (!$quote or !$quote instanceof Quote) {
if (!$quote || !$quote instanceof Quote) {
return $this->getErrorResponse();
}

Expand All @@ -106,6 +106,8 @@ public function execute()
}

/**
* Get error response.
*
* @return Json
*/
private function getErrorResponse()
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Security/Model/SecurityChecker/Quantity.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function check($securityEventType, $accountReference = null, $longIp = null)
{
$isEnabled = $this->securityConfig->getPasswordResetProtectionType() != ResetMethod::OPTION_NONE;
$allowedAttemptsNumber = $this->securityConfig->getMaxNumberPasswordResetRequests();
if ($isEnabled and $allowedAttemptsNumber) {
if ($isEnabled && $allowedAttemptsNumber) {
$collection = $this->prepareCollection($securityEventType, $accountReference, $longIp);
if ($collection->count() >= $allowedAttemptsNumber) {
throw new SecurityViolationException(
Expand Down
15 changes: 9 additions & 6 deletions app/code/Magento/SendFriend/Model/SendFriend.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* @method \Magento\SendFriend\Model\SendFriend setTime(int $value)
*
* @author Magento Core Team <[email protected]>
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*
* @api
Expand Down Expand Up @@ -162,6 +163,8 @@ protected function _construct()
}

/**
* Send email.
*
* @return $this
* @throws CoreException
*/
Expand Down Expand Up @@ -236,7 +239,7 @@ public function validate()
}

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

Expand Down Expand Up @@ -281,13 +284,13 @@ public function setRecipients($recipients)
// validate array
if (!is_array(
$recipients
) or !isset(
) || !isset(
$recipients['email']
) or !isset(
) || !isset(
$recipients['name']
) or !is_array(
) || !is_array(
$recipients['email']
) or !is_array(
) || !is_array(
$recipients['name']
)
) {
Expand Down Expand Up @@ -487,7 +490,7 @@ protected function _sentCountByCookies($increment = false)
$oldTimes = explode(',', $oldTimes);
foreach ($oldTimes as $oldTime) {
$periodTime = $time - $this->_sendfriendData->getPeriod();
if (is_numeric($oldTime) and $oldTime >= $periodTime) {
if (is_numeric($oldTime) && $oldTime >= $periodTime) {
$newTimes[] = $oldTime;
}
}
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/Tax/Model/Sales/Total/Quote/Tax.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ protected function processExtraTaxables(Address\Total $total, array $itemsByType
{
$extraTaxableDetails = [];
foreach ($itemsByType as $itemType => $itemTaxDetails) {
if ($itemType != self::ITEM_TYPE_PRODUCT and $itemType != self::ITEM_TYPE_SHIPPING) {
if ($itemType != self::ITEM_TYPE_PRODUCT && $itemType != self::ITEM_TYPE_SHIPPING) {
foreach ($itemTaxDetails as $itemCode => $itemTaxDetail) {
/** @var \Magento\Tax\Api\Data\TaxDetailsInterface $taxDetails */
$taxDetails = $itemTaxDetail[self::KEY_ITEM];
Expand Down Expand Up @@ -407,6 +407,7 @@ protected function enhanceTotalData(

/**
* Process model configuration array.
*
* This method can be used for changing totals collect sort order
*
* @param array $config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private function assertClassesExist($classes, $path)
foreach ($classes as $class) {
$class = trim($class, '\\');
try {
if (strrchr($class, '\\') === false and !Classes::isVirtual($class)) {
if (strrchr($class, '\\') === false && !Classes::isVirtual($class)) {
$badUsages[] = $class;
continue;
} else {
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/Magento/Framework/Filter/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public function templateDirective($construction)
{
// Processing of {template config_path=... [...]} statement
$templateParameters = $this->getParameters($construction[2]);
if (!isset($templateParameters['config_path']) or !$this->getTemplateProcessor()) {
if (!isset($templateParameters['config_path']) || !$this->getTemplateProcessor()) {
// Not specified template or not set include processor
$replacedValue = '{Error in template processing}';
} else {
Expand Down
4 changes: 3 additions & 1 deletion lib/internal/Magento/Framework/Message/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

/**
* Message manager model
*
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Manager implements ManagerInterface
Expand Down Expand Up @@ -226,7 +228,7 @@ public function addUniqueMessages(array $messages, $group = null)
$items = $this->getMessages(false, $group)->getItems();

foreach ($messages as $message) {
if ($message instanceof MessageInterface and !in_array($message, $items, false)) {
if ($message instanceof MessageInterface && !in_array($message, $items, false)) {
$this->addMessage($message, $group);
}
}
Expand Down
8 changes: 4 additions & 4 deletions setup/src/Magento/Setup/Model/ConfigOptionsList/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class Session implements ConfigOptionsListInterface
];

/**
* {@inheritdoc}
* @inheritdoc
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function getOptions()
Expand Down Expand Up @@ -250,7 +250,7 @@ public function getOptions()
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function createConfig(array $options, DeploymentConfig $deploymentConfig)
{
Expand Down Expand Up @@ -281,7 +281,7 @@ public function createConfig(array $options, DeploymentConfig $deploymentConfig)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function validate(array $options, DeploymentConfig $deploymentConfig)
{
Expand All @@ -301,7 +301,7 @@ public function validate(array $options, DeploymentConfig $deploymentConfig)

if (isset($options[self::INPUT_KEY_SESSION_REDIS_LOG_LEVEL])) {
$level = $options[self::INPUT_KEY_SESSION_REDIS_LOG_LEVEL];
if (($level < 0) or ($level > 7)) {
if (($level < 0) || ($level > 7)) {
$errors[] = "Invalid Redis log level '{$level}'. Valid range is 0-7, inclusive.";
}
}
Expand Down