Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.3-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - #17960: [Forwardport] Move functions.php into Framework (by @fooman)
 - #17765: [Forwardport] Clean code (by @nmalevanec)
 - #17768: [Forwardport] Fix proxy generation return type (by @nmalevanec)
 - #17941: [Forwardport] Sales: Add unit test for validator model class (by @dmytro-ch)
 - #17946: [2.3]  changed intval($val) to (int) $val, since `(int) $val ` is faster. (by @TBlindaruk)
 - #17938: Replace sort callbacks to spaceship operator (by @mage2pratik)
 - #17922: [Forwardport] API-functional test for Search (by @mage2pratik)
 - #17921: [Forwardport] Remove leading Countrycode from EU-VAT-Numbers (by @mage2pratik)
 - #17874: [Forwardport] Fix - Next Page button triggered when filtering Customer grid (by @ronak2ram)
 - #17911: [Forwardport] Resolved : Wishlist icon cut on Shopping cart page in mobile view #17851 #27 (by @hitesh-wagento)
 - #17848: Fix for invalid JSON if image label contains HTML markup, example " (by @jeroenschipper)
 - #17832: [Forwardport] Fix translation issue (by @nmalevanec)
 - #17837: [Forwardport] [Search] Unit test for SynonymAnalyzer model (by @furseyev)
 - #17829: [Forwardport] CSS load order incorrect using default_head_blocks.xml #1821 (by @nmalevanec)
 - #17750: [Forwardport] Unable to change attribute type from swatch (by @nmalevanec)
 - #17650: Use route ID when creating secret keys in backend menus instead of route name (by @lfolco)


Fixed GitHub Issues:
 - #17789: Next Page button triggered when filtering Customer grid (reported by @lucasjor-summa) has been fixed in #17874 by @ronak2ram in 2.3-develop branch
   Related commits:
     1. 92c1aa4
     2. a2993a5
     3. c580a46

 - #17851: Wishlist icon cut on Shopping cart page in mobile view (reported by @hitesh-wagento) has been fixed in #17911 by @hitesh-wagento in 2.3-develop branch
   Related commits:
     1. f0b5ecc

 - #1821: CSS load order incorrect using default_head_blocks.xml (reported by @chicgeek) has been fixed in #17829 by @nmalevanec in 2.3-develop branch
   Related commits:
     1. d3e24ed
     2. fe6c96f

 - #9307: Color attribute taking swatch instead of Drop down option for configurable options, (reported by @vishveskrish) has been fixed in #17750 by @nmalevanec in 2.3-develop branch
   Related commits:
     1. 0f28b61
     2. d159921

 - #9923: Upgrading to 2.1.7 changed dropdown attributes to swatches (reported by @roseofgold) has been fixed in #17750 by @nmalevanec in 2.3-develop branch
   Related commits:
     1. 0f28b61
     2. d159921

 - #11403: Product Attributes Not Updating on Frontend (reported by @rbur0425) has been fixed in #17750 by @nmalevanec in 2.3-develop branch
   Related commits:
     1. 0f28b61
     2. d159921

 - #11703: Changing Swatches to Drop-down does not remove swatches from existing products (reported by @expgabe) has been fixed in #17750 by @nmalevanec in 2.3-develop branch
   Related commits:
     1. 0f28b61
     2. d159921

 - #12695: Unable to change attribute type from swatch to dropdown  (reported by @alena-marchenko) has been fixed in #17750 by @nmalevanec in 2.3-develop branch
   Related commits:
     1. 0f28b61
     2. d159921

 - #7557: Backend Security key broken for controllers with frontname not equal to route ID (reported by @AlexandreKhayrullin) has been fixed in #17650 by @lfolco in 2.3-develop branch
   Related commits:
     1. 2662dfa
     2. a0dfb6d
     3. 35eba04
     4. 600a185
     5. 062286e
     6. c3d700a
     7. be7c961
     8. fa8a222
     9. b738ce6
     10. af3507a
  • Loading branch information
ishakhsuvarov authored Sep 11, 2018
2 parents cfaa388 + f767f7b commit 61fb87f
Show file tree
Hide file tree
Showing 73 changed files with 677 additions and 180 deletions.
2 changes: 0 additions & 2 deletions app/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
// Sets default autoload mappings, may be overridden in Bootstrap::create
\Magento\Framework\App\Bootstrap::populateAutoloader(BP, []);

require_once BP . '/app/functions.php';

/* Custom umask value may be provided in optional mage_umask file in root */
$umaskFile = BP . '/magento_umask';
$mask = file_exists($umaskFile) ? octdec(file_get_contents($umaskFile)) : 002;
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Analytics/ReportXml/ReportProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function __construct(
private function getIteratorName(Query $query)
{
$config = $query->getConfig();
return isset($config['iterator']) ? $config['iterator'] : null;
return $config['iterator'] ?? null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/App/DefaultPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ public function __construct(\Magento\Backend\App\ConfigInterface $config)
*/
public function getPart($code)
{
return isset($this->_parts[$code]) ? $this->_parts[$code] : null;
return $this->_parts[$code] ?? null;
}
}
16 changes: 14 additions & 2 deletions app/code/Magento/Backend/Block/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,23 @@ class Menu extends \Magento\Backend\Block\Template
*/
private $anchorRenderer;

/**
* @var ConfigInterface
*/
private $routeConfig;

/**
* @param Template\Context $context
* @param \Magento\Backend\Model\UrlInterface $url
* @param \Magento\Backend\Model\Menu\Filter\IteratorFactory $iteratorFactory
* @param \Magento\Backend\Model\Auth\Session $authSession
* @param \Magento\Backend\Model\Menu\Config $menuConfig
* @param \Magento\Framework\Locale\ResolverInterface $localeResolver
* @param \Magento\Framework\App\Route\ConfigInterface $routeConfig
* @param array $data
* @param MenuItemChecker|null $menuItemChecker
* @param AnchorRenderer|null $anchorRenderer
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
Expand All @@ -94,7 +101,8 @@ public function __construct(
\Magento\Framework\Locale\ResolverInterface $localeResolver,
array $data = [],
MenuItemChecker $menuItemChecker = null,
AnchorRenderer $anchorRenderer = null
AnchorRenderer $anchorRenderer = null,
\Magento\Framework\App\Route\ConfigInterface $routeConfig = null
) {
$this->_url = $url;
$this->_iteratorFactory = $iteratorFactory;
Expand All @@ -103,6 +111,9 @@ public function __construct(
$this->_localeResolver = $localeResolver;
$this->menuItemChecker = $menuItemChecker;
$this->anchorRenderer = $anchorRenderer;
$this->routeConfig = $routeConfig ?:
\Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Framework\App\Route\ConfigInterface::class);
parent::__construct($context, $data);
}

Expand Down Expand Up @@ -203,8 +214,9 @@ protected function _afterToHtml($html)
*/
protected function _callbackSecretKey($match)
{
$routeId = $this->routeConfig->getRouteByFrontName($match[1]);
return \Magento\Backend\Model\UrlInterface::SECRET_KEY_PARAM_NAME . '/' . $this->_url->getSecretKey(
$match[1],
$routeId,
$match[2],
$match[3]
);
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Backend/Block/Widget/Button/ButtonList.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ public function getItems()
*/
public function sortButtons(Item $itemA, Item $itemB)
{
$sortOrderA = intval($itemA->getSortOrder());
$sortOrderB = intval($itemB->getSortOrder());
$sortOrderA = (int) $itemA->getSortOrder();
$sortOrderB = (int) $itemB->getSortOrder();

if ($sortOrderA == $sortOrderB) {
return 0;
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Model/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function add(Item $item, $parentId = null, $index = null)
}
$parentItem->getChildren()->add($item, null, $index);
} else {
$index = intval($index);
$index = (int) $index;
if (!isset($this[$index])) {
$this->offsetSet($index, $item);
$this->_logger->info(
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Model/Menu/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,6 @@ public function getResult(\Magento\Backend\Model\Menu $menu)
*/
protected function _getParam($params, $paramName, $defaultValue = null)
{
return isset($params[$paramName]) ? $params[$paramName] : $defaultValue;
return $params[$paramName] ?? $defaultValue;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0;
<?= /* @escapeNotVerified */ __('of %1', '<span>' . $block->getCollection()->getLastPageNumber() . '</span>') ?>
</label>
<?php if ($_curPage < $_lastPage): ?>
<button title="<?= /* @escapeNotVerified */ __('Next page') ?>"
<button type="button" title="<?= /* @escapeNotVerified */ __('Next page') ?>"
class="action-next"
onclick="<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.setPage('<?= /* @escapeNotVerified */ ($_curPage + 1) ?>');return false;">
<span><?= /* @escapeNotVerified */ __('Next page') ?></span>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backup/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function getBackupsDir()
public function getExtensionByType($type)
{
$extensions = $this->getExtensions();
return isset($extensions[$type]) ? $extensions[$type] : '';
return $extensions[$type] ?? '';
}

/**
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Backup/Model/Config/Backend/Cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public function afterSave()

if ($enabled) {
$cronExprArray = [
intval($time[1]), # Minute
intval($time[0]), # Hour
(int) $time[1], # Minute
(int) $time[0], # Hour
$frequency == $frequencyMonthly ? '1' : '*', # Day of the Month
'*', # Month of the Year
$frequency == $frequencyWeekly ? '1' : '*', # Day of the Week
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Bundle/Model/Product/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ public function updateQtyOption($options, \Magento\Framework\DataObject $option,
*/
public function prepareQuoteItemQty($qty, $product)
{
return intval($qty);
return (int) $qty;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ function ($title, $storeName) {
*/
protected function getTypeValue($type)
{
return isset($this->typeMapping[$type]) ? $this->typeMapping[$type] : self::VALUE_DYNAMIC;
return $this->typeMapping[$type] ?? self::VALUE_DYNAMIC;
}

/**
Expand All @@ -333,7 +333,7 @@ protected function getTypeValue($type)
*/
protected function getPriceViewValue($type)
{
return isset($this->priceViewMapping[$type]) ? $this->priceViewMapping[$type] : self::VALUE_PRICE_RANGE;
return $this->priceViewMapping[$type] ?? self::VALUE_PRICE_RANGE;
}

/**
Expand All @@ -344,7 +344,7 @@ protected function getPriceViewValue($type)
*/
protected function getPriceTypeValue($type)
{
return isset($this->priceTypeMapping[$type]) ? $this->priceTypeMapping[$type] : null;
return $this->priceTypeMapping[$type] ?? null;
}

/**
Expand All @@ -355,7 +355,7 @@ protected function getPriceTypeValue($type)
*/
private function getShipmentTypeValue($type)
{
return isset($this->shipmentTypeMapping[$type]) ? $this->shipmentTypeMapping[$type] : null;
return $this->shipmentTypeMapping[$type] ?? null;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public function resolve(\Magento\Framework\App\RequestInterface $request, $formI
{
$captchaParams = $request->getPost(\Magento\Captcha\Helper\Data::INPUT_NAME_FIELD_VALUE);

return isset($captchaParams[$formId]) ? $captchaParams[$formId] : '';
return $captchaParams[$formId] ?? '';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function getFieldSuffix()
public function getStoreId()
{
$storeId = $this->getRequest()->getParam('store');
return intval($storeId);
return (int) $storeId;
}

/**
Expand Down
9 changes: 4 additions & 5 deletions app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
namespace Magento\Catalog\Block\Product\ProductList;

use Magento\Catalog\Model\ResourceModel\Product\Collection;
use Magento\Framework\View\Element\AbstractBlock;

/**
* Catalog product upsell items block
Expand Down Expand Up @@ -170,8 +169,8 @@ public function getRowCount()
*/
public function setColumnCount($columns)
{
if (intval($columns) > 0) {
$this->_columnCount = intval($columns);
if ((int) $columns > 0) {
$this->_columnCount = (int) $columns;
}
return $this;
}
Expand Down Expand Up @@ -213,8 +212,8 @@ public function getIterableItem()
*/
public function setItemLimit($type, $limit)
{
if (intval($limit) > 0) {
$this->_itemLimits[$type] = intval($limit);
if ((int) $limit > 0) {
$this->_itemLimits[$type] = (int) $limit;
}
return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Block/Product/View/Gallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public function getImageAttribute($imageId, $attributeName, $default = null)
{
$attributes =
$this->getConfigView()->getMediaAttributes('Magento_Catalog', Image::MEDIA_TYPE_CONFIG_NODE, $imageId);
return isset($attributes[$attributeName]) ? $attributes[$attributeName] : $default;
return $attributes[$attributeName] ?? $default;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions app/code/Magento/Catalog/Cron/FrontendActionsFlush.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ private function getLifeTimeByNamespace($namespace)
];
}

return isset($configuration['lifetime']) ?
(int) $configuration['lifetime'] : FrontendStorageConfigurationInterface::DEFAULT_LIFETIME;
return (int)$configuration['lifetime'] ?? FrontendStorageConfigurationInterface::DEFAULT_LIFETIME;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Helper/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ public function getFrame()
*/
protected function getAttribute($name)
{
return isset($this->attributes[$name]) ? $this->attributes[$name] : null;
return $this->attributes[$name] ?? null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Helper/Output.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function addHandler($method, $handler)
public function getHandlers($method)
{
$method = strtolower($method);
return isset($this->_handlers[$method]) ? $this->_handlers[$method] : [];
return $this->_handlers[$method] ?? [];
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private function mapConditionType(string $conditionType, string $field): string
];
}

return isset($conditionsMap[$conditionType]) ? $conditionsMap[$conditionType] : $conditionType;
return $conditionsMap[$conditionType] ?? $conditionType;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ public function getProductTypeName($id)

$this->loadProductTypes();

return isset($this->_productTypesById[$id]) ? $this->_productTypesById[$id] : false;
return $this->_productTypesById[$id] ?? false;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
namespace Magento\Catalog\Model\Indexer\Category\Flat;

use Magento\Framework\App\ResourceConnection;
use Magento\Framework\EntityManager\MetadataPool;

class AbstractAction
{
Expand Down Expand Up @@ -111,7 +110,7 @@ public function getColumns()
public function getMainStoreTable($storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID)
{
if (is_string($storeId)) {
$storeId = intval($storeId);
$storeId = (int) $storeId;
}

$suffix = sprintf('store_%d', $storeId);
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Model/Product/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ public function resize()
*/
public function rotate($angle)
{
$angle = intval($angle);
$angle = (int) $angle;
$this->getImageProcessor()->rotate($angle);
return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Model/Product/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ public function getGroupByType($type = null)
self::OPTION_TYPE_TIME => self::OPTION_GROUP_DATE,
];

return isset($optionGroupsToTypes[$type]) ? $optionGroupsToTypes[$type] : '';
return $optionGroupsToTypes[$type] ?? '';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public function getFormattedOptionValue($optionValue)
*/
public function getCustomizedView($optionInfo)
{
return isset($optionInfo['value']) ? $optionInfo['value'] : $optionInfo;
return $optionInfo['value'] ?? $optionInfo;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ public function __construct(array $validators)
*/
public function get($type)
{
return isset($this->validators[$type]) ? $this->validators[$type] : $this->validators['default'];
return $this->validators[$type] ?? $this->validators['default'];
}
}
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Model/Product/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public function getOptions()
public function getOptionText($optionId)
{
$options = $this->getOptionArray();
return isset($options[$optionId]) ? $options[$optionId] : null;
return $options[$optionId] ?? null;
}

/**
Expand Down
4 changes: 1 addition & 3 deletions app/code/Magento/Catalog/Ui/Component/FilterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ public function create($attribute, $context, $config = [])
*/
protected function getFilterType($attribute)
{
return isset($this->filterMap[$attribute->getFrontendInput()])
? $this->filterMap[$attribute->getFrontendInput()]
: $this->filterMap['default'];
return $this->filterMap[$attribute->getFrontendInput()] ?? $this->filterMap['default'];
}
}
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Ui/Component/Listing/Columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ public function prepare()
*/
protected function getFilterType($frontendInput)
{
return isset($this->filterMap[$frontendInput]) ? $this->filterMap[$frontendInput] : $this->filterMap['default'];
return $this->filterMap[$frontendInput] ?? $this->filterMap['default'];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ private function getFormElementsMapValue($value)
{
$valueMap = $this->formElementMapper->getMappings();

return isset($valueMap[$value]) ? $valueMap[$value] : $value;
return $valueMap[$value] ?? $value;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public function clearFailedCategories()
*/
public function getCategoryById($categoryId)
{
return isset($this->categoriesCache[$categoryId]) ? $this->categoriesCache[$categoryId] : null;
return $this->categoriesCache[$categoryId] ?? null;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function getNewSku($sku = null)
{
if ($sku !== null) {
$sku = strtolower($sku);
return isset($this->newSkus[$sku]) ? $this->newSkus[$sku] : null;
return $this->newSkus[$sku] ?? null;
}
return $this->newSkus;
}
Expand Down
Loading

0 comments on commit 61fb87f

Please sign in to comment.