diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php index 91975350b682b..80966c38a40e1 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php @@ -37,9 +37,8 @@ public function __construct( */ public function render(\Magento\Framework\DataObject $row) { - $readDetailsHtml = $row->getUrl() ? '' . __( - 'Read Details' - ) . '' : ''; + $readDetailsHtml = $row->getUrl() ? '' + . __('Read Details') . '' : ''; $markAsReadHtml = !$row->getIsRead() ? 'hasChildren() + ? 'onmouseover="Element.addClassName(this,\'over\')" onmouseout="Element.removeClassName(this,\'over\')"' + : ''; } /** diff --git a/app/code/Magento/Backend/Block/Page/Header.php b/app/code/Magento/Backend/Block/Page/Header.php index 4e878e4e63ffb..4c0dfff078ffd 100644 --- a/app/code/Magento/Backend/Block/Page/Header.php +++ b/app/code/Magento/Backend/Block/Page/Header.php @@ -6,6 +6,8 @@ namespace Magento\Backend\Block\Page; +use Magento\Store\Model\ScopeInterface; + /** * Adminhtml header block * @@ -78,6 +80,6 @@ public function getLogoutLink() */ public function displayNoscriptNotice() { - return $this->_scopeConfig->getValue('web/browser_capabilities/javascript', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + return $this->_scopeConfig->getValue('web/browser_capabilities/javascript', ScopeInterface::SCOPE_STORE); } } diff --git a/app/code/Magento/Backend/Block/Page/Notices.php b/app/code/Magento/Backend/Block/Page/Notices.php index 84b60b4532363..1ea08c704a037 100644 --- a/app/code/Magento/Backend/Block/Page/Notices.php +++ b/app/code/Magento/Backend/Block/Page/Notices.php @@ -11,6 +11,8 @@ */ namespace Magento\Backend\Block\Page; +use Magento\Store\Model\ScopeInterface; + class Notices extends \Magento\Backend\Block\Template { /** @@ -20,7 +22,7 @@ class Notices extends \Magento\Backend\Block\Template */ public function displayNoscriptNotice() { - return $this->_scopeConfig->getValue('web/browser_capabilities/javascript', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + return $this->_scopeConfig->getValue('web/browser_capabilities/javascript', ScopeInterface::SCOPE_STORE); } /** @@ -30,6 +32,6 @@ public function displayNoscriptNotice() */ public function displayDemoNotice() { - return $this->_scopeConfig->getValue('design/head/demonotice', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + return $this->_scopeConfig->getValue('design/head/demonotice', ScopeInterface::SCOPE_STORE); } } diff --git a/app/code/Magento/Backend/Block/Store/Switcher/Form/Renderer/Fieldset.php b/app/code/Magento/Backend/Block/Store/Switcher/Form/Renderer/Fieldset.php index 3186eb69bbdf8..a74e103bf4b21 100644 --- a/app/code/Magento/Backend/Block/Store/Switcher/Form/Renderer/Fieldset.php +++ b/app/code/Magento/Backend/Block/Store/Switcher/Form/Renderer/Fieldset.php @@ -6,10 +6,12 @@ namespace Magento\Backend\Block\Store\Switcher\Form\Renderer; +use Magento\Framework\Data\Form\Element\Renderer\RendererInterface; + /** * Form fieldset renderer */ -class Fieldset extends \Magento\Backend\Block\Template implements \Magento\Framework\Data\Form\Element\Renderer\RendererInterface +class Fieldset extends \Magento\Backend\Block\Template implements RendererInterface { /** * Form element which re-rendering diff --git a/app/code/Magento/Backend/Block/Widget/Form/Renderer/Element.php b/app/code/Magento/Backend/Block/Widget/Form/Renderer/Element.php index b546245cbbfdb..a59afc6248577 100644 --- a/app/code/Magento/Backend/Block/Widget/Form/Renderer/Element.php +++ b/app/code/Magento/Backend/Block/Widget/Form/Renderer/Element.php @@ -7,13 +7,14 @@ namespace Magento\Backend\Block\Widget\Form\Renderer; use Magento\Framework\Data\Form\Element\AbstractElement; +use Magento\Framework\Data\Form\Element\Renderer\RendererInterface; /** * Form element default renderer * * @author Magento Core Team */ -class Element extends \Magento\Backend\Block\Template implements \Magento\Framework\Data\Form\Element\Renderer\RendererInterface +class Element extends \Magento\Backend\Block\Template implements RendererInterface { /** * @var AbstractElement diff --git a/app/code/Magento/Backend/Block/Widget/Form/Renderer/Fieldset.php b/app/code/Magento/Backend/Block/Widget/Form/Renderer/Fieldset.php index 1582ee387fc06..ac4e14a2da3fa 100644 --- a/app/code/Magento/Backend/Block/Widget/Form/Renderer/Fieldset.php +++ b/app/code/Magento/Backend/Block/Widget/Form/Renderer/Fieldset.php @@ -7,13 +7,14 @@ namespace Magento\Backend\Block\Widget\Form\Renderer; use Magento\Framework\Data\Form\Element\AbstractElement; +use Magento\Framework\Data\Form\Element\Renderer\RendererInterface; /** * Form fieldset default renderer * * @author Magento Core Team */ -class Fieldset extends \Magento\Backend\Block\Template implements \Magento\Framework\Data\Form\Element\Renderer\RendererInterface +class Fieldset extends \Magento\Backend\Block\Template implements RendererInterface { /** * @var AbstractElement diff --git a/app/code/Magento/Backend/Block/Widget/Form/Renderer/Fieldset/Element.php b/app/code/Magento/Backend/Block/Widget/Form/Renderer/Fieldset/Element.php index f416a47b79b3d..ce5f8ca1d37f6 100644 --- a/app/code/Magento/Backend/Block/Widget/Form/Renderer/Fieldset/Element.php +++ b/app/code/Magento/Backend/Block/Widget/Form/Renderer/Fieldset/Element.php @@ -7,13 +7,14 @@ namespace Magento\Backend\Block\Widget\Form\Renderer\Fieldset; use Magento\Framework\Data\Form\Element\AbstractElement; +use Magento\Framework\Data\Form\Element\Renderer\RendererInterface; /** * Fieldset element renderer * * @author Magento Core Team */ -class Element extends \Magento\Backend\Block\Template implements \Magento\Framework\Data\Form\Element\Renderer\RendererInterface +class Element extends \Magento\Backend\Block\Template implements RendererInterface { /** * @var AbstractElement diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Action.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Action.php index 790fa95b098e8..6c6e4ba97ff49 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Action.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Action.php @@ -153,7 +153,11 @@ protected function _transformActionData(&$action, &$actionCaption, \Magento\Fram break; case 'popup': - $action['onclick'] = 'popWin(this.href,\'_blank\',\'width=800,height=700,resizable=1,scrollbars=1\');return false;'; + $action['onclick'] = 'popWin( + this.href, + \'_blank\', + \'width=800,height=700,resizable=1,scrollbars=1\' + );return false;'; break; } } diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Export.php b/app/code/Magento/Backend/Block/Widget/Grid/Export.php index ab929e1c06341..55d176ea95a99 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Export.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Export.php @@ -282,8 +282,10 @@ public function _exportIterateCollection($callback, array $args) * @param \Magento\Framework\Filesystem\File\WriteInterface $stream * @return void */ - protected function _exportCsvItem(\Magento\Framework\DataObject $item, \Magento\Framework\Filesystem\File\WriteInterface $stream) - { + protected function _exportCsvItem( + \Magento\Framework\DataObject $item, + \Magento\Framework\Filesystem\File\WriteInterface $stream + ) { $row = []; foreach ($this->_getColumns() as $column) { if (!$column->getIsSystem()) { diff --git a/app/code/Magento/Backend/Model/Menu/Director/Director.php b/app/code/Magento/Backend/Model/Menu/Director/Director.php index d6009f7c5c590..7f36ec1509c8a 100644 --- a/app/code/Magento/Backend/Model/Menu/Director/Director.php +++ b/app/code/Magento/Backend/Model/Menu/Director/Director.php @@ -41,8 +41,11 @@ protected function _getCommand($data, $logger) * @param \Psr\Log\LoggerInterface $logger * @return void */ - public function direct(array $config, \Magento\Backend\Model\Menu\Builder $builder, \Psr\Log\LoggerInterface $logger) - { + public function direct( + array $config, + \Magento\Backend\Model\Menu\Builder $builder, + \Psr\Log\LoggerInterface $logger + ) { foreach ($config as $data) { $builder->processCommand($this->_getCommand($data, $logger)); } diff --git a/app/code/Magento/Backend/Model/Widget/Grid/AbstractTotals.php b/app/code/Magento/Backend/Model/Widget/Grid/AbstractTotals.php index 4dd995a1f9037..4903d67809079 100644 --- a/app/code/Magento/Backend/Model/Widget/Grid/AbstractTotals.php +++ b/app/code/Magento/Backend/Model/Widget/Grid/AbstractTotals.php @@ -44,8 +44,10 @@ abstract class AbstractTotals implements \Magento\Backend\Model\Widget\Grid\Tota * @param \Magento\Framework\DataObject\Factory $factory * @param \Magento\Backend\Model\Widget\Grid\Parser $parser */ - public function __construct(\Magento\Framework\DataObject\Factory $factory, \Magento\Backend\Model\Widget\Grid\Parser $parser) - { + public function __construct( + \Magento\Framework\DataObject\Factory $factory, + \Magento\Backend\Model\Widget\Grid\Parser $parser + ) { $this->_factory = $factory; $this->_parser = $parser; } diff --git a/app/code/Magento/Backup/Model/ResourceModel/Helper.php b/app/code/Magento/Backup/Model/ResourceModel/Helper.php index a5ccaaea3ee54..9348f820ebd6b 100644 --- a/app/code/Magento/Backup/Model/ResourceModel/Helper.php +++ b/app/code/Magento/Backup/Model/ResourceModel/Helper.php @@ -174,7 +174,9 @@ public function getHeader() $dbConfig = $this->getConnection()->getConfig(); $versionRow = $this->getConnection()->fetchRow('SHOW VARIABLES LIKE \'version\''); - $hostName = !empty($dbConfig['unix_socket']) ? $dbConfig['unix_socket'] : (!empty($dbConfig['host']) ? $dbConfig['host'] : 'localhost'); + $hostName = !empty($dbConfig['unix_socket']) + ? $dbConfig['unix_socket'] + : (!empty($dbConfig['host']) ? $dbConfig['host'] : 'localhost'); $header = "-- Magento DB backup\n" . "--\n" . diff --git a/app/code/Magento/Braintree/Model/Ui/PayPal/ConfigProvider.php b/app/code/Magento/Braintree/Model/Ui/PayPal/ConfigProvider.php index 6735c2ec5418f..261c2824e01cf 100644 --- a/app/code/Magento/Braintree/Model/Ui/PayPal/ConfigProvider.php +++ b/app/code/Magento/Braintree/Model/Ui/PayPal/ConfigProvider.php @@ -55,7 +55,8 @@ public function getConfig() 'isAllowShippingAddressOverride' => $this->config->isAllowToEditShippingAddress(), 'merchantName' => $this->config->getMerchantName(), 'locale' => strtolower($this->resolver->getLocale()), - 'paymentAcceptanceMarkSrc' => 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png', + 'paymentAcceptanceMarkSrc' + => 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png', 'vaultCode' => self::PAYPAL_VAULT_CODE, 'skipOrderReview' => $this->config->isSkipOrderReview(), 'paymentIcon' => $this->config->getPayPalIcon(), diff --git a/app/code/Magento/Braintree/Test/Unit/Model/Ui/PayPal/ConfigProviderTest.php b/app/code/Magento/Braintree/Test/Unit/Model/Ui/PayPal/ConfigProviderTest.php index c77c528f6b402..8751c2ada8f6b 100644 --- a/app/code/Magento/Braintree/Test/Unit/Model/Ui/PayPal/ConfigProviderTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Model/Ui/PayPal/ConfigProviderTest.php @@ -102,7 +102,8 @@ public function getConfigDataProvider() 'isAllowShippingAddressOverride' => true, 'merchantName' => 'Test', 'locale' => 'en_us', - 'paymentAcceptanceMarkSrc' => 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png', + 'paymentAcceptanceMarkSrc' + => 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png', 'vaultCode' => ConfigProvider::PAYPAL_VAULT_CODE, 'skipOrderReview' => false, 'paymentIcon' => [ diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php index 6ee6b29798964..bd44f05eafad6 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php @@ -220,7 +220,9 @@ public function getProduct() public function getSelectionQtyTitlePrice($selection, $includeContainer = true) { $this->setFormatProduct($selection); - $priceTitle = '' . $selection->getSelectionQty() * 1 . ' x ' . $this->escapeHtml($selection->getName()) . ''; + $priceTitle = '' + . $selection->getSelectionQty() * 1 . ' x ' . $this->escapeHtml($selection->getName()) + . ''; $priceTitle .= '   ' . ($includeContainer ? '' : '') . '+' . $this->renderPriceString($selection, $includeContainer) . ($includeContainer ? '' : ''); diff --git a/app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php b/app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php index 6d266cc2455fa..7b34e3871f673 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php @@ -185,7 +185,6 @@ protected function setUp() ->disableOriginalConstructor() ->getMock(); $this->model = $helper->getObject( - LinkManagement::class, [ 'productRepository' => $this->productRepository, @@ -654,7 +653,7 @@ public function testSaveChild() $productLink->expects($this->any())->method('getQty')->will($this->returnValue($qty)); $productLink->expects($this->any())->method('getPriceType')->will($this->returnValue($priceType)); $productLink->expects($this->any())->method('getPrice')->will($this->returnValue($price)); - $productLink->expects($this->any())->method('getCanChangeQuantity')->will($this->returnValue($canChangeQuantity)); + $productLink->expects($this->any())->method('getCanChangeQuantity')->willReturn($canChangeQuantity); $productLink->expects($this->any())->method('getIsDefault')->will($this->returnValue($isDefault)); $this->metadataMock->expects($this->once())->method('getLinkField')->willReturn($this->linkField); diff --git a/app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php b/app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php index 2ba92f7578db5..d3f3102a951e6 100644 --- a/app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php +++ b/app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php @@ -134,8 +134,10 @@ public function modifyMeta(array $meta) 'autoRender' => false, 'componentType' => 'insertListing', 'dataScope' => 'bundle_product_listing', - 'externalProvider' => 'bundle_product_listing.bundle_product_listing_data_source', - 'selectionsProvider' => 'bundle_product_listing.bundle_product_listing.product_columns.ids', + 'externalProvider' => + 'bundle_product_listing.bundle_product_listing_data_source', + 'selectionsProvider' => + 'bundle_product_listing.bundle_product_listing.product_columns.ids', 'ns' => 'bundle_product_listing', 'render_url' => $this->urlBuilder->getUrl('mui/index/render'), 'realTimeLink' => false, diff --git a/app/code/Magento/Captcha/Model/Config/Form/AbstractForm.php b/app/code/Magento/Captcha/Model/Config/Form/AbstractForm.php index 1ee4dbcd35803..63415b9a8b628 100644 --- a/app/code/Magento/Captcha/Model/Config/Form/AbstractForm.php +++ b/app/code/Magento/Captcha/Model/Config/Form/AbstractForm.php @@ -11,7 +11,9 @@ */ namespace Magento\Captcha\Model\Config\Form; -abstract class AbstractForm extends \Magento\Framework\App\Config\Value implements \Magento\Framework\Option\ArrayInterface +use Magento\Framework\Option\ArrayInterface; + +abstract class AbstractForm extends \Magento\Framework\App\Config\Value implements ArrayInterface { /** * @var string diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php index 12cda865393a9..7d9ada5e441a1 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php @@ -226,7 +226,7 @@ public function getStoreSwitcherHtml() public function getLoadTreeUrl($expanded = null) { $params = ['_current' => true, 'id' => null, 'store' => null]; - if ($expanded === null&& $this->_backendSession->getIsTreeWasExpanded() || $expanded == true) { + if ($expanded === null && $this->_backendSession->getIsTreeWasExpanded() || $expanded == true) { $params['expand_all'] = true; } return $this->getUrl('*/*/categoriesJson', $params); @@ -310,12 +310,12 @@ public function getBreadcrumbsJavascript($path, $javascriptVarName) foreach ($categories as $key => $category) { $categories[$key] = $this->_getNodeJson($category); } - return ''; + return ''; } /** diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php index 2099ab7cd6c88..3927f4538ac3a 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php @@ -134,7 +134,8 @@ protected function _getAdditionalElementHtml($element) $checkboxLabel = __('Change'); $html = << - + diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts.php index 674398a703c2e..62b9341a95414 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts.php @@ -28,8 +28,14 @@ protected function _prepareLayout() )->setId('productAlerts'); /* @var $accordion \Magento\Backend\Block\Widget\Accordion */ - $alertPriceAllow = $this->_scopeConfig->getValue('catalog/productalert/allow_price', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); - $alertStockAllow = $this->_scopeConfig->getValue('catalog/productalert/allow_stock', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + $alertPriceAllow = $this->_scopeConfig->getValue( + 'catalog/productalert/allow_price', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + $alertStockAllow = $this->_scopeConfig->getValue( + 'catalog/productalert/allow_stock', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); if ($alertPriceAllow) { $accordion->addItem( @@ -76,8 +82,14 @@ public function getAccordionHtml() */ public function canShowTab() { - $alertPriceAllow = $this->_scopeConfig->getValue('catalog/productalert/allow_price', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); - $alertStockAllow = $this->_scopeConfig->getValue('catalog/productalert/allow_stock', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + $alertPriceAllow = $this->_scopeConfig->getValue( + 'catalog/productalert/allow_price', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + $alertStockAllow = $this->_scopeConfig->getValue( + 'catalog/productalert/allow_stock', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); return ($alertPriceAllow || $alertStockAllow) && parent::canShowTab(); } } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php index f619da73e0c45..e4e96b4f62494 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php @@ -342,7 +342,8 @@ public function getOptionValues() $_value->getStoreTitle() === null, $_value->getOptionTypeId() ); - $value['optionValues'][$i]['scopeTitleDisabled'] = $_value->getStoreTitle() === null ? 'disabled' : null; + $value['optionValues'][$i]['scopeTitleDisabled'] + = $_value->getStoreTitle() === null ? 'disabled' : null; if ($scope == \Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE) { $value['optionValues'][$i]['checkboxScopePrice'] = $this->getCheckboxScopeHtml( $_value->getOptionId(), @@ -351,7 +352,8 @@ public function getOptionValues() $_value->getOptionTypeId(), ['$(this).up(1).previous()'] ); - $value['optionValues'][$i]['scopePriceDisabled'] = $_value->getStorePrice() === null ? 'disabled' : null; + $value['optionValues'][$i]['scopePriceDisabled'] + = $_value->getStorePrice() === null ? 'disabled' : null; } } $i++; diff --git a/app/code/Magento/Catalog/Block/Breadcrumbs.php b/app/code/Magento/Catalog/Block/Breadcrumbs.php index 74ecefd16d3fc..674c99001b01a 100644 --- a/app/code/Magento/Catalog/Block/Breadcrumbs.php +++ b/app/code/Magento/Catalog/Block/Breadcrumbs.php @@ -41,7 +41,11 @@ public function __construct(Context $context, Data $catalogData, array $data = [ */ public function getTitleSeparator($store = null) { - $separator = (string)$this->_scopeConfig->getValue('catalog/seo/title_separator', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); + $separator = (string)$this->_scopeConfig->getValue( + 'catalog/seo/title_separator', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); return ' ' . $separator . ' '; } diff --git a/app/code/Magento/Catalog/Block/Navigation.php b/app/code/Magento/Catalog/Block/Navigation.php index 2998703f429e1..095e71bb7f70a 100644 --- a/app/code/Magento/Catalog/Block/Navigation.php +++ b/app/code/Magento/Catalog/Block/Navigation.php @@ -8,6 +8,7 @@ use Magento\Catalog\Model\Category; use Magento\Customer\Model\Context; +use Magento\Framework\DataObject\IdentityInterface; /** * Catalog navigation @@ -15,7 +16,7 @@ * @SuppressWarnings(PHPMD.LongVariable) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Navigation extends \Magento\Framework\View\Element\Template implements \Magento\Framework\DataObject\IdentityInterface +class Navigation extends \Magento\Framework\View\Element\Template implements IdentityInterface { /** * @var Category diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php index 2cc42fd4f9bd2..45fd03d9e8244 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php @@ -7,13 +7,14 @@ namespace Magento\Catalog\Block\Product\ProductList; use Magento\Catalog\Model\ResourceModel\Product\Collection; +use Magento\Framework\DataObject\IdentityInterface; /** * Catalog product related items block * * @SuppressWarnings(PHPMD.LongVariable) */ -class Related extends \Magento\Catalog\Block\Product\AbstractProduct implements \Magento\Framework\DataObject\IdentityInterface +class Related extends \Magento\Catalog\Block\Product\AbstractProduct implements IdentityInterface { /** * @var Collection diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php index b8f5891d9351c..f7804d240972d 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php @@ -7,13 +7,14 @@ namespace Magento\Catalog\Block\Product\ProductList; use Magento\Catalog\Model\ResourceModel\Product\Collection; +use Magento\Framework\DataObject\IdentityInterface; /** * Catalog product upsell items block * * @SuppressWarnings(PHPMD.LongVariable) */ -class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct implements \Magento\Framework\DataObject\IdentityInterface +class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct implements IdentityInterface { /** * @var int diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php index 116a35c82d15c..13358e53ef675 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php @@ -21,7 +21,7 @@ abstract class Attribute extends Action const ADMIN_RESOURCE = 'Magento_Catalog::update_attributes'; /** - * @var \Magento\Catalog\Helper\Product\Edit\Action\Attribute + * @var \Magento\Catalog\Helper\Product\Edit\Action\Attribute */ protected $attributeHelper; diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php index 76f5a01e97e61..72ffb8de79203 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php @@ -126,7 +126,9 @@ public function execute() $attributeCode = $this->getRequest()->getParam('attribute_code') ?: $this->generateCode($this->getRequest()->getParam('frontend_label')[0]); if (strlen($attributeCode) > 0) { - $validatorAttrCode = new \Zend_Validate_Regex(['pattern' => '/^[a-z\x{600}-\x{6FF}][a-z\x{600}-\x{6FF}_0-9]{0,30}$/u']); + $validatorAttrCode = new \Zend_Validate_Regex( + ['pattern' => '/^[a-z\x{600}-\x{6FF}][a-z\x{600}-\x{6FF}_0-9]{0,30}$/u'] + ); if (!$validatorAttrCode->isValid($attributeCode)) { $this->messageManager->addError( __( @@ -193,7 +195,7 @@ public function execute() $data += ['is_filterable' => 0, 'is_filterable_in_search' => 0, 'apply_to' => []]; - if ($model->getIsUserDefined() === null|| $model->getIsUserDefined() != 0) { + if ($model->getIsUserDefined() === null || $model->getIsUserDefined() != 0) { $data['backend_type'] = $model->getBackendTypeByInput($data['frontend_input']); } diff --git a/app/code/Magento/Catalog/Helper/Product/ProductList.php b/app/code/Magento/Catalog/Helper/Product/ProductList.php index 5767fd903b577..6e30aa6f6c0f2 100644 --- a/app/code/Magento/Catalog/Helper/Product/ProductList.php +++ b/app/code/Magento/Catalog/Helper/Product/ProductList.php @@ -6,6 +6,8 @@ namespace Magento\Catalog\Helper\Product; +use Magento\Store\Model\ScopeInterface; + /** * Class ProductList * @@ -22,6 +24,7 @@ class ProductList const VIEW_MODE_GRID = 'grid'; const DEFAULT_SORT_DIRECTION = 'asc'; + /** * @var \Magento\Framework\App\Config\ScopeConfigInterface */ @@ -50,7 +53,7 @@ public function __construct( */ public function getAvailableViewMode() { - switch ($this->scopeConfig->getValue(self::XML_PATH_LIST_MODE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { + switch ($this->scopeConfig->getValue(self::XML_PATH_LIST_MODE, ScopeInterface::SCOPE_STORE)) { case 'grid': $availableMode = ['grid' => __('Grid')]; break; @@ -96,7 +99,7 @@ public function getDefaultSortField() { return $this->scopeConfig->getValue( \Magento\Catalog\Model\Config::XML_PATH_LIST_DEFAULT_SORT_BY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE ); } @@ -114,13 +117,13 @@ public function getAvailableLimit($mode) $perPageConfigKey = 'catalog/frontend/' . $mode . '_per_page_values'; $perPageValues = (string)$this->scopeConfig->getValue( $perPageConfigKey, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE ); $perPageValues = explode(',', $perPageValues); $perPageValues = array_combine($perPageValues, $perPageValues); if ($this->scopeConfig->isSetFlag( 'catalog/frontend/list_allow_all', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE )) { return ($perPageValues + ['all' => __('All')]); } else { @@ -139,12 +142,12 @@ public function getDefaultLimitPerPageValue($viewMode) if ($viewMode == self::VIEW_MODE_LIST) { return $this->scopeConfig->getValue( 'catalog/frontend/list_per_page', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE ); } elseif ($viewMode == self::VIEW_MODE_GRID) { return $this->scopeConfig->getValue( 'catalog/frontend/grid_per_page', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE ); } return 0; diff --git a/app/code/Magento/Catalog/Model/Config.php b/app/code/Magento/Catalog/Model/Config.php index 99f562be43214..d2ffd6f440041 100644 --- a/app/code/Magento/Catalog/Model/Config.php +++ b/app/code/Magento/Catalog/Model/Config.php @@ -490,6 +490,10 @@ public function getAttributeUsedForSortByArray() */ public function getProductListDefaultSortBy($store = null) { - return $this->_scopeConfig->getValue(self::XML_PATH_LIST_DEFAULT_SORT_BY, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); + return $this->_scopeConfig->getValue( + self::XML_PATH_LIST_DEFAULT_SORT_BY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } } diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php index 626f675ed7c76..a3e662fb45bb4 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php @@ -136,7 +136,9 @@ protected function getFlatTableStructure($tableName) //Adding columns foreach ($this->getColumns() as $fieldName => $fieldProp) { $default = $fieldProp['default']; - if ($fieldProp['type'][0] == \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP && $default == 'CURRENT_TIMESTAMP') { + if ($fieldProp['type'][0] == \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP + && $default == 'CURRENT_TIMESTAMP' + ) { $default = \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT; } $table->addColumn( diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php index 09d05e1ca44c3..8e9499202d6f4 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php @@ -440,7 +440,7 @@ protected function createAnchorSelect(\Magento\Store\Model\Store $store) )->joinInner( ['cpsd' => $this->getTable('catalog_product_entity_int')], 'cpsd.' . $productLinkField . ' = cpe.' . $productLinkField . ' AND cpsd.store_id = 0' - . ' AND cpsd.attribute_id = ' . $statusAttributeId, + . ' AND cpsd.attribute_id = ' . $statusAttributeId, [] )->joinLeft( ['cpss' => $this->getTable('catalog_product_entity_int')], @@ -561,6 +561,7 @@ protected function makeTempCategoryTreeIndex() * Populate the temporary category tree index table * * @param string $temporaryName + * @return void */ protected function fillTempCategoryTreeIndex($temporaryName) { diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/MviewState.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/MviewState.php index dc838caa9705d..3ef814216a38c 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/MviewState.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/MviewState.php @@ -51,8 +51,9 @@ public function __construct( public function afterSetStatus(\Magento\Framework\Mview\View\StateInterface $state) { if (in_array($state->getViewId(), $this->viewIds)) { - $viewId = $state->getViewId() == - \Magento\Catalog\Model\Indexer\Category\Product::INDEXER_ID ? \Magento\Catalog\Model\Indexer\Product\Category::INDEXER_ID : \Magento\Catalog\Model\Indexer\Category\Product::INDEXER_ID; + $viewId = $state->getViewId() == \Magento\Catalog\Model\Indexer\Category\Product::INDEXER_ID + ? \Magento\Catalog\Model\Indexer\Product\Category::INDEXER_ID + : \Magento\Catalog\Model\Indexer\Category\Product::INDEXER_ID; $relatedViewState = $this->state->loadByView($viewId); diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/Store.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/Store.php index ec69191dd7bcd..ef7919193e609 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/Store.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/Store.php @@ -32,8 +32,10 @@ public function __construct(\Magento\Catalog\Model\Indexer\Product\Flat\Processo * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function beforeSave(\Magento\Store\Model\ResourceModel\Store $subject, \Magento\Framework\Model\AbstractModel $object) - { + public function beforeSave( + \Magento\Store\Model\ResourceModel\Store $subject, + \Magento\Framework\Model\AbstractModel $object + ) { if (!$object->getId() || $object->dataHasChangedFor('group_id')) { $this->_productFlatIndexerProcessor->markIndexerAsInvalid(); } diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreGroup.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreGroup.php index 11f5122098c42..df62fe8d349e4 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreGroup.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreGroup.php @@ -32,8 +32,10 @@ public function __construct(\Magento\Catalog\Model\Indexer\Product\Flat\Processo * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function beforeSave(\Magento\Store\Model\ResourceModel\Group $subject, \Magento\Framework\Model\AbstractModel $object) - { + public function beforeSave( + \Magento\Store\Model\ResourceModel\Group $subject, + \Magento\Framework\Model\AbstractModel $object + ) { if (!$object->getId() || $object->dataHasChangedFor('root_category_id')) { $this->_productFlatIndexerProcessor->markIndexerAsInvalid(); } diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Price.php b/app/code/Magento/Catalog/Model/Layer/Filter/Price.php index cca03f3196bf2..0372f2750be76 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Price.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Price.php @@ -273,7 +273,10 @@ protected function _getItemsData() { $algorithm = $this->algorithmFactory->create(); - return $algorithm->getItemsData((array)$this->dataProvider->getInterval(), $this->dataProvider->getAdditionalRequestData()); + return $algorithm->getItemsData( + (array)$this->dataProvider->getInterval(), + $this->dataProvider->getAdditionalRequestData() + ); } /** diff --git a/app/code/Magento/Catalog/Model/Product/Action.php b/app/code/Magento/Catalog/Model/Product/Action.php index f8075ad7795d9..25e5510bee070 100644 --- a/app/code/Magento/Catalog/Model/Product/Action.php +++ b/app/code/Magento/Catalog/Model/Product/Action.php @@ -96,7 +96,7 @@ public function updateAttributes($productIds, $attrData, $storeId) { $this->_eventManager->dispatch( 'catalog_product_attribute_update_before', - ['attributes_data' => &$attrData, 'product_ids' => &$productIds, 'store_id' => &$storeId] + ['attributes_data' => $attrData, 'product_ids' => $productIds, 'store_id' => $storeId] ); $this->_getResource()->updateAttributes($productIds, $attrData, $storeId); diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php index 138b800a33e01..9369123f8679f 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php @@ -329,6 +329,7 @@ private function getWebsiteId($storeId) /** * @param \Magento\Catalog\Model\Product $object * @param array $priceData + * @return void */ public function setPriceData($object, $priceData) { diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Source/Inputtype.php b/app/code/Magento/Catalog/Model/Product/Attribute/Source/Inputtype.php index fcd3eae9db73d..adbd6579e6828 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Source/Inputtype.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Source/Inputtype.php @@ -29,8 +29,10 @@ class Inputtype extends \Magento\Eav\Model\Adminhtml\System\Config\Source\Inputt * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param \Magento\Framework\Registry $coreRegistry */ - public function __construct(\Magento\Framework\Event\ManagerInterface $eventManager, \Magento\Framework\Registry $coreRegistry) - { + public function __construct( + \Magento\Framework\Event\ManagerInterface $eventManager, + \Magento\Framework\Registry $coreRegistry + ) { $this->_eventManager = $eventManager; $this->_coreRegistry = $coreRegistry; } diff --git a/app/code/Magento/Catalog/Model/Product/Media/Config.php b/app/code/Magento/Catalog/Model/Product/Media/Config.php index 35d9c86ca9836..39addcce22069 100644 --- a/app/code/Magento/Catalog/Model/Product/Media/Config.php +++ b/app/code/Magento/Catalog/Model/Product/Media/Config.php @@ -7,6 +7,7 @@ namespace Magento\Catalog\Model\Product\Media; use Magento\Eav\Model\Entity\Attribute; +use Magento\Framework\UrlInterface; use Magento\Store\Model\StoreManagerInterface; /** @@ -73,7 +74,7 @@ public function getBaseMediaPath() */ public function getBaseMediaUrl() { - return $this->storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . 'catalog/product'; + return $this->storeManager->getStore()->getBaseUrl(UrlInterface::URL_TYPE_MEDIA) . 'catalog/product'; } /** @@ -93,7 +94,7 @@ public function getBaseTmpMediaPath() public function getBaseTmpMediaUrl() { return $this->storeManager->getStore()->getBaseUrl( - \Magento\Framework\UrlInterface::URL_TYPE_MEDIA + UrlInterface::URL_TYPE_MEDIA ) . 'tmp/' . $this->getBaseMediaUrlAddition(); } diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php b/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php index 1736a443287f2..62bc549feb8c8 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php @@ -8,6 +8,7 @@ use Magento\Catalog\Api\Data\ProductCustomOptionInterface; use Magento\Framework\Exception\LocalizedException; +use Magento\Store\Model\ScopeInterface; /** * Catalog product option default type @@ -191,7 +192,7 @@ public function getRequest() */ public function getConfigData($key) { - return $this->_scopeConfig->getValue('catalog/custom_options/' . $key, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + return $this->_scopeConfig->getValue('catalog/custom_options/' . $key, ScopeInterface::SCOPE_STORE); } /** diff --git a/app/code/Magento/Catalog/Model/Product/Option/Value.php b/app/code/Magento/Catalog/Model/Product/Option/Value.php index 21af96dbcb1c1..54e6d59f45d10 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Value.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Value.php @@ -238,7 +238,8 @@ public function getPrice($flag = false) public function getRegularPrice() { if ($this->getPriceType() == self::TYPE_PERCENT) { - $basePrice = $this->getOption()->getProduct()->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue(); + $basePrice = $this->getOption()->getProduct()->getPriceInfo() + ->getPrice('regular_price')->getAmount()->getValue(); $price = $basePrice * ($this->_getData(self::KEY_PRICE) / 100); return $price; } diff --git a/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php b/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php index 9237b41de71ac..1b86ecbcecbd7 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php @@ -7,6 +7,9 @@ namespace Magento\Catalog\Model\ResourceModel; use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; +use Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend; +use Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend; +use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource; /** * Catalog entity abstract model @@ -85,18 +88,20 @@ protected function _isApplicableAttribute($object, $attribute) /** * Check whether attribute instance (attribute, backend, frontend or source) has method and applicable * - * @param AbstractAttribute|\Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend|\Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend|\Magento\Eav\Model\Entity\Attribute\Source\AbstractSource $instance + * @param AbstractAttribute|AbstractBackend|AbstractFrontend|AbstractSource $instance * @param string $method * @param array $args array of arguments * @return boolean */ protected function _isCallableAttributeInstance($instance, $method, $args) { - if ($instance instanceof \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend + if ($instance instanceof AbstractBackend && ($method == 'beforeSave' || $method == 'afterSave') ) { $attributeCode = $instance->getAttribute()->getAttributeCode(); - if (isset($args[0]) && $args[0] instanceof \Magento\Framework\DataObject && $args[0]->getData($attributeCode) === false) { + if (isset($args[0]) && $args[0] instanceof \Magento\Framework\DataObject + && $args[0]->getData($attributeCode) === false + ) { return false; } } diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php index 1e9b66338d935..409d3d3449b35 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php @@ -489,7 +489,7 @@ public function isEnabledFlat() protected function _construct() { if ($this->isEnabledFlat()) { - $this->_init(\Magento\Catalog\Model\Product::class, \Magento\Catalog\Model\ResourceModel\Product\Flat::class); + $this->_init(\Magento\Catalog\Model\Product::class, Flat::class); } else { $this->_init(\Magento\Catalog\Model\Product::class, \Magento\Catalog\Model\ResourceModel\Product::class); } @@ -507,7 +507,7 @@ protected function _construct() protected function _init($model, $entityModel) { if ($this->isEnabledFlat()) { - $entityModel = \Magento\Catalog\Model\ResourceModel\Product\Flat::class; + $entityModel = Flat::class; } return parent::_init($model, $entityModel); } diff --git a/app/code/Magento/Catalog/Model/Template/Filter.php b/app/code/Magento/Catalog/Model/Template/Filter.php index 465968f39555e..092ee10618ab3 100644 --- a/app/code/Magento/Catalog/Model/Template/Filter.php +++ b/app/code/Magento/Catalog/Model/Template/Filter.php @@ -12,6 +12,8 @@ */ namespace Magento\Catalog\Model\Template; +use Magento\Framework\UrlInterface; + /** * Work with catalog(store, website) urls * @@ -126,7 +128,7 @@ public function viewDirective($construction) public function mediaDirective($construction) { $params = $this->getParameters($construction[2]); - return $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . $params['url']; + return $this->_storeManager->getStore()->getBaseUrl(UrlInterface::URL_TYPE_MEDIA) . $params['url']; } /** diff --git a/app/code/Magento/Catalog/Setup/CategorySetup.php b/app/code/Magento/Catalog/Setup/CategorySetup.php index 8c3b5c7acd6bb..eac11347a4b1a 100644 --- a/app/code/Magento/Catalog/Setup/CategorySetup.php +++ b/app/code/Magento/Catalog/Setup/CategorySetup.php @@ -84,7 +84,8 @@ public function getDefaultEntities() 'attribute_model' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::class, 'table' => 'catalog_category_entity', 'additional_attribute_table' => 'catalog_eav_attribute', - 'entity_attribute_collection' => \Magento\Catalog\Model\ResourceModel\Category\Attribute\Collection::class, + 'entity_attribute_collection' + => \Magento\Catalog\Model\ResourceModel\Category\Attribute\Collection::class, 'attributes' => [ 'name' => [ 'type' => 'varchar', @@ -301,7 +302,8 @@ public function getDefaultEntities() 'source' => \Magento\Catalog\Model\Category\Attribute\Source\Sortby::class, 'backend' => \Magento\Catalog\Model\Category\Attribute\Backend\Sortby::class, 'sort_order' => 50, - 'input_renderer' => \Magento\Catalog\Block\Adminhtml\Category\Helper\Sortby\DefaultSortby::class, + 'input_renderer' + => \Magento\Catalog\Block\Adminhtml\Category\Helper\Sortby\DefaultSortby::class, 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE, 'group' => 'Display Settings', ], @@ -353,7 +355,8 @@ public function getDefaultEntities() 'attribute_model' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::class, 'table' => 'catalog_product_entity', 'additional_attribute_table' => 'catalog_eav_attribute', - 'entity_attribute_collection' => \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection::class, + 'entity_attribute_collection' + => \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection::class, 'attributes' => [ 'name' => [ 'type' => 'varchar', diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Edit/Button/AddAttributeTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Edit/Button/AddAttributeTest.php index fa11fc626361e..bcfa1b642dcbf 100644 --- a/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Edit/Button/AddAttributeTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Edit/Button/AddAttributeTest.php @@ -27,7 +27,8 @@ public function testGetButtonData() 'actionName' => 'toggleModal' ], [ - 'targetName' => 'product_form.product_form.add_attribute_modal.product_attributes_grid', + 'targetName' => + 'product_form.product_form.add_attribute_modal.product_attributes_grid', 'actionName' => 'render' ] ] diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/CustomlayoutupdateTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/CustomlayoutupdateTest.php index 88ec2c3ed5347..302b61f545b63 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/CustomlayoutupdateTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/CustomlayoutupdateTest.php @@ -93,17 +93,15 @@ private function getMockedValidator() $mock->expects($this->any()) ->method('isValid') ->will( - /** - * @param string $xml - * $return bool - */ $this->returnCallback( + // @codingStandardsIgnoreStart + /** + * @param string $xml + * $return bool + */ + // @codingStandardsIgnoreEnd function ($xml) { - if ($xml == 'exception') { - return false; - } else { - return true; - } + return $xml != 'exception'; } ) ); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php index a805410f6842e..176cb65073662 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php @@ -375,8 +375,12 @@ public function reindexFlatEnabledTestDataProvider() * * @dataProvider reindexFlatEnabledTestDataProvider */ - public function testReindexFlatEnabled($flatScheduled, $productScheduled, $expectedFlatReindexCalls, $expectedProductReindexCall) - { + public function testReindexFlatEnabled( + $flatScheduled, + $productScheduled, + $expectedFlatReindexCalls, + $expectedProductReindexCall + ) { $affectedProductIds = ["1", "2"]; $this->category->setAffectedProductIds($affectedProductIds); $pathIds = ['path/1/2', 'path/2/3']; @@ -390,8 +394,9 @@ public function testReindexFlatEnabled($flatScheduled, $productScheduled, $expec $this->flatIndexer->expects($this->exactly(1))->method('isScheduled')->will($this->returnValue($flatScheduled)); $this->flatIndexer->expects($this->exactly($expectedFlatReindexCalls))->method('reindexRow')->with('123'); - $this->productIndexer->expects($this->exactly(1))->method('isScheduled')->will($this->returnValue($productScheduled)); - $this->productIndexer->expects($this->exactly($expectedProductReindexCall))->method('reindexList')->with($pathIds); + $this->productIndexer->expects($this->exactly(1))->method('isScheduled')->willReturn($productScheduled); + $this->productIndexer->expects($this->exactly($expectedProductReindexCall)) + ->method('reindexList')->with($pathIds); $this->indexerRegistry->expects($this->at(0)) ->method('get') diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Layer/Category/FilterableAttributeListTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Layer/Category/FilterableAttributeListTest.php index ba1a3871a89ee..c149d4111d62c 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Layer/Category/FilterableAttributeListTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Layer/Category/FilterableAttributeListTest.php @@ -6,6 +6,8 @@ namespace Magento\Catalog\Test\Unit\Model\Layer\Category; +use Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory; + class FilterableAttributeListTest extends \PHPUnit_Framework_TestCase { /** @@ -14,7 +16,7 @@ class FilterableAttributeListTest extends \PHPUnit_Framework_TestCase protected $model; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory + * @var \PHPUnit_Framework_MockObject_MockObject|CollectionFactory */ protected $collectionFactoryMock; @@ -26,7 +28,7 @@ class FilterableAttributeListTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->collectionFactoryMock = $this->getMock( - \Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory::class, + CollectionFactory::class, ['create'], [], '', diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Layer/Search/FilterableAttributeListTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Layer/Search/FilterableAttributeListTest.php index df3b286f2feb9..ac0a785fbcd95 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Layer/Search/FilterableAttributeListTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Layer/Search/FilterableAttributeListTest.php @@ -6,6 +6,8 @@ namespace Magento\Catalog\Test\Unit\Model\Layer\Search; +use Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory; + class FilterableAttributeListTest extends \PHPUnit_Framework_TestCase { /** @@ -14,7 +16,7 @@ class FilterableAttributeListTest extends \PHPUnit_Framework_TestCase protected $model; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory + * @var \PHPUnit_Framework_MockObject_MockObject|CollectionFactory */ protected $collectionFactoryMock; @@ -26,7 +28,7 @@ class FilterableAttributeListTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->collectionFactoryMock = $this->getMock( - \Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory::class, + CollectionFactory::class, ['create'], [], '', diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php index fd6244231f394..abedf27a1057b 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php @@ -1311,8 +1311,8 @@ public function testSaveWithDifferentWebsites() 2 => ['second'], 3 => ['third'] ]); - $this->productMock->expects($this->once())->method('getWebsiteIds')->willReturn([1,2,3]); - $this->productMock->expects($this->once())->method('setWebsiteIds')->willReturn([2,3]); + $this->productMock->expects($this->once())->method('getWebsiteIds')->willReturn([1, 2, 3]); + $this->productMock->expects($this->once())->method('setWebsiteIds')->willReturn([2, 3]); $this->assertEquals($this->productMock, $this->model->save($this->productMock)); } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php index 5aff975e5b2b4..8c879464dc0f5 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php @@ -1281,7 +1281,8 @@ public function testGetMediaGalleryImagesMerging() ->disableOriginalConstructor() ->getMock(); $this->collectionFactoryMock->expects($this->once())->method('create')->willReturn($imagesCollectionMock); - $imagesCollectionMock->expects($this->at(2))->method('getItemById')->with(1)->willReturn($expectedImageDataObject); + $imagesCollectionMock->expects($this->at(2))->method('getItemById')->with(1) + ->willReturn($expectedImageDataObject); $this->mediaConfig->expects($this->at(0)) ->method('getMediaUrl') ->willReturn('http://magento.dev/pub/imageFile.jpg'); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Eav/AttributeTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Eav/AttributeTest.php index 31482104625d5..58565054a3a52 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Eav/AttributeTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Eav/AttributeTest.php @@ -6,6 +6,8 @@ namespace Magento\Catalog\Test\Unit\Model\ResourceModel\Eav; +use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; + /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -146,9 +148,9 @@ public function testIndexerAfterSaveScopeChangeAttribute() { $this->_processor->expects($this->once())->method('markIndexerAsInvalid'); - $this->_model->setOrigData('is_global', \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE); + $this->_model->setOrigData('is_global', ScopedAttributeInterface::SCOPE_STORE); $this->_model->setOrigData('used_in_product_listing', 1); - $this->_model->setIsGlobal(\Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL); + $this->_model->setIsGlobal(ScopedAttributeInterface::SCOPE_GLOBAL); $this->_model->afterSave(); } @@ -187,7 +189,7 @@ public function testGetScopeGlobal() 'indexerEavProcessor' => $this->_eavProcessor, 'resource' => $this->resourceMock, 'data' => [ - 'is_global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL + 'is_global' => ScopedAttributeInterface::SCOPE_GLOBAL ] ] ); @@ -205,7 +207,7 @@ public function testGetScopeWebiste() 'indexerEavProcessor' => $this->_eavProcessor, 'resource' => $this->resourceMock, 'data' => [ - 'is_global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_WEBSITE + 'is_global' => ScopedAttributeInterface::SCOPE_WEBSITE ] ] ); diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php index 72f9dc19eda2d..3614c7a1de25d 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php @@ -381,7 +381,8 @@ private function addAdvancedPriceLink() 'additionalForGroup' => true, 'provider' => false, 'source' => 'product_details', - 'sortOrder' => $this->arrayManager->get($pricePath . '/arguments/data/config/sortOrder', $this->meta) + 1, + 'sortOrder' + => $this->arrayManager->get($pricePath . '/arguments/data/config/sortOrder', $this->meta) + 1, ]; $this->meta = $this->arrayManager->set( @@ -418,7 +419,10 @@ private function getTierPriceStructure($tierPricePath) ], 'disabled' => false, 'required' => false, - 'sortOrder' => $this->arrayManager->get($tierPricePath . '/arguments/data/config/sortOrder', $this->meta), + 'sortOrder' => $this->arrayManager->get( + $tierPricePath . '/arguments/data/config/sortOrder', + $this->meta + ), ], ], ], @@ -552,7 +556,10 @@ private function specialPriceDataToInline() 'additionalClasses' => 'admin__control-grouped-date', 'breakLine' => false, 'component' => 'Magento_Ui/js/form/components/group', - 'scopeLabel' => $this->arrayManager->get($pathFrom . '/arguments/data/config/scopeLabel', $this->meta), + 'scopeLabel' => $this->arrayManager->get( + $pathFrom . '/arguments/data/config/scopeLabel', + $this->meta + ), ] ); $this->meta = $this->arrayManager->merge( diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php index e3300bb200d63..704797c1b29ac 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php @@ -262,11 +262,13 @@ protected function customizeCategoriesField(array $meta) 'actionName' => 'toggleModal', ], [ - 'targetName' => 'product_form.product_form.create_category_modal.create_category', + 'targetName' + => 'product_form.product_form.create_category_modal.create_category', 'actionName' => 'render' ], [ - 'targetName' => 'product_form.product_form.create_category_modal.create_category', + 'targetName' + => 'product_form.product_form.create_category_modal.create_category', 'actionName' => 'resetForm' ] ], diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index 5eafd25342343..1f5bbe690f013 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -177,6 +177,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity * @var string */ protected $mediaGalleryValueTableName; + /** * @var string */ @@ -268,6 +269,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity ValidatorInterface::ERROR_EXCEEDED_MAX_LENGTH => 'Attribute %s exceeded max length', ValidatorInterface::ERROR_INVALID_ATTRIBUTE_TYPE => 'Value for \'%s\' attribute contains incorrect value', ValidatorInterface::ERROR_ABSENT_REQUIRED_ATTRIBUTE => 'Attribute %s is required', + // @codingStandardsIgnoreStart ValidatorInterface::ERROR_INVALID_ATTRIBUTE_OPTION => 'Value for \'%s\' attribute contains incorrect value, see acceptable values on settings specified for Admin', ValidatorInterface::ERROR_DUPLICATE_UNIQUE_ATTRIBUTE => 'Duplicated unique attribute', ValidatorInterface::ERROR_INVALID_VARIATIONS_CUSTOM_OPTIONS => 'Value for \'%s\' sub attribute in \'%s\' attribute contains incorrect value, acceptable values are: \'dropdown\', \'checkbox\', \'radio\', \'text\'', @@ -276,6 +278,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity ValidatorInterface::ERROR_MEDIA_URL_NOT_ACCESSIBLE => 'Imported resource (image) could not be downloaded from external resource due to timeout or access permissions', ValidatorInterface::ERROR_INVALID_WEIGHT => 'Product weight is invalid', ValidatorInterface::ERROR_DUPLICATE_URL_KEY => 'Url key: \'%s\' was already generated for an item with the SKU: \'%s\'. You need to specify the unique URL key manually' + // @codingStandardsIgnoreEnd ]; /** @@ -666,8 +669,8 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity * @param \Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration * @param \Magento\CatalogInventory\Model\Spi\StockStateProviderInterface $stockStateProvider * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\ImportExport\Model\Import\Config $importConfig - * @param Proxy\Product\ResourceFactory $resourceFactory + * @param Import\Config $importConfig + * @param Proxy\Product\ResourceModelFactory $resourceFactory * @param Product\OptionFactory $optionFactory * @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory $setColFactory * @param Product\Type\Factory $productTypeFactory @@ -688,10 +691,10 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity * @param TransactionManagerInterface $transactionManager * @param Product\TaxClassProcessor $taxClassProcessor * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Catalog\Model\Product\Url $productUrl * @param array $data * @param array $dateAttrCodes * @throws \Magento\Framework\Exception\LocalizedException - * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -926,7 +929,10 @@ protected function _deleteProducts() $this->transactionManager->rollBack(); throw $e; } - $this->_eventManager->dispatch('catalog_product_import_bunch_delete_after', ['adapter' => $this, 'bunch' => $bunch]); + $this->_eventManager->dispatch( + 'catalog_product_import_bunch_delete_after', + ['adapter' => $this, 'bunch' => $bunch] + ); } } return $this; @@ -1060,6 +1066,7 @@ protected function _initTypeModels() /** * Initialize Product error templates + * @return void */ protected function _initErrorTemplates() { @@ -1159,7 +1166,7 @@ protected function _saveLinks() : []; foreach ($linkSkus as $linkedKey => $linkedSku) { $linkedSku = trim($linkedSku); - if (($this->skuProcessor->getNewSku($linkedSku) !== null|| isset( + if (($this->skuProcessor->getNewSku($linkedSku) !== null || isset( $this->_oldSku[$linkedSku] )) && $linkedSku != $sku ) { @@ -1559,7 +1566,8 @@ protected function _saveProducts() // existing row $entityRowsUp[] = [ 'updated_at' => (new \DateTime())->format(DateTime::DATETIME_PHP_FORMAT), - $this->getProductEntityLinkField() => $this->_oldSku[$rowSku][$this->getProductEntityLinkField()], + $this->getProductEntityLinkField() + => $this->_oldSku[$rowSku][$this->getProductEntityLinkField()], ]; } else { if (!$productLimit || $productsQty < $productLimit) { @@ -1661,7 +1669,8 @@ protected function _saveProducts() if ($uploadedFile && !isset($mediaGallery[$rowSku][$uploadedFile])) { if (isset($existingImages[$rowSku][$uploadedFile])) { if (isset($rowLabels[$column][$columnImageKey]) - && $rowLabels[$column][$columnImageKey] != $existingImages[$rowSku][$uploadedFile]['label'] + && $rowLabels[$column][$columnImageKey] + != $existingImages[$rowSku][$uploadedFile]['label'] ) { $labelsForUpdate[] = [ 'label' => $rowLabels[$column][$columnImageKey], @@ -1674,7 +1683,9 @@ protected function _saveProducts() } $mediaGallery[$rowSku][$uploadedFile] = [ 'attribute_id' => $this->getMediaGalleryAttributeId(), - 'label' => isset($rowLabels[$column][$columnImageKey]) ? $rowLabels[$column][$columnImageKey] : '', + 'label' => isset($rowLabels[$column][$columnImageKey]) + ? $rowLabels[$column][$columnImageKey] + : '', 'position' => ++$position, 'disabled' => isset($disabledImages[$columnImage]) ? '1' : '0', 'value' => $uploadedFile, @@ -1700,7 +1711,7 @@ protected function _saveProducts() if ($prevAttributeSet !== null) { $rowData[self::COL_ATTR_SET] = $prevAttributeSet; } - if ($productType === null&& $previousType !== null) { + if ($productType === null && $previousType !== null) { $productType = $previousType; } if ($productType === null) { @@ -1961,6 +1972,7 @@ public function getUploader() * Return a new file name if the same file is already exists. * * @param string $fileName + * @param bool $renameFileOff * @return string */ protected function uploadMediaFiles($fileName, $renameFileOff = false) @@ -2241,7 +2253,7 @@ public function getEntityTypeCode() /** * New products SKU data. * - * @var string $sku + * @param string $sku * @return array */ public function getNewSku($sku = null) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php index 23dac6d6b7917..cb86559553a08 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php @@ -1347,16 +1347,19 @@ protected function _collectOptionTypeData( // ensure default title is set if (!isset($typeTitles[$nextValueId][\Magento\Store\Model\Store::DEFAULT_STORE_ID])) { - $typeTitles[$nextValueId][\Magento\Store\Model\Store::DEFAULT_STORE_ID] = $specificTypeData['title']; + $typeTitles[$nextValueId][\Magento\Store\Model\Store::DEFAULT_STORE_ID] + = $specificTypeData['title']; } if ($specificTypeData['price']) { if ($this->_isPriceGlobal) { - $typePrices[$nextValueId][\Magento\Store\Model\Store::DEFAULT_STORE_ID] = $specificTypeData['price']; + $typePrices[$nextValueId][\Magento\Store\Model\Store::DEFAULT_STORE_ID] + = $specificTypeData['price']; } else { // ensure default price is set if (!isset($typePrices[$nextValueId][\Magento\Store\Model\Store::DEFAULT_STORE_ID])) { - $typePrices[$nextValueId][\Magento\Store\Model\Store::DEFAULT_STORE_ID] = $specificTypeData['price']; + $typePrices[$nextValueId][\Magento\Store\Model\Store::DEFAULT_STORE_ID] + = $specificTypeData['price']; } $typePrices[$nextValueId][$this->_rowStoreId] = $specificTypeData['price']; } @@ -1373,7 +1376,8 @@ protected function _collectOptionTypeData( if (!isset($childCount[$this->_rowStoreId][$prevOptionId])) { $childCount[$this->_rowStoreId][$prevOptionId] = 0; } - $parentValueId = $nextValueId - $parentCount[$prevOptionId] + $childCount[$this->_rowStoreId][$prevOptionId]; + $parentValueId = $nextValueId - $parentCount[$prevOptionId] + + $childCount[$this->_rowStoreId][$prevOptionId]; $specificTypeData = $this->_getSpecificTypeData($rowData, $parentValueId, false); //For others stores if ($specificTypeData) { @@ -1826,7 +1830,11 @@ protected function _parseCustomOptions($rowData) if (empty($rowData['custom_options'])) { return $rowData; } - $rowData['custom_options'] = str_replace($beforeOptionValueSkuDelimiter, $this->_productEntity->getMultipleValueSeparator(), $rowData['custom_options']); + $rowData['custom_options'] = str_replace( + $beforeOptionValueSkuDelimiter, + $this->_productEntity->getMultipleValueSeparator(), + $rowData['custom_options'] + ); $options = []; $optionValues = explode(Product::PSEUDO_MULTI_LINE_SEPARATOR, $rowData['custom_options']); $k = 0; diff --git a/app/code/Magento/CatalogImportExport/Model/Indexer/Category/Product/Plugin/Import.php b/app/code/Magento/CatalogImportExport/Model/Indexer/Category/Product/Plugin/Import.php index d0df26266d1f4..d8a926f7cfe31 100644 --- a/app/code/Magento/CatalogImportExport/Model/Indexer/Category/Product/Plugin/Import.php +++ b/app/code/Magento/CatalogImportExport/Model/Indexer/Category/Product/Plugin/Import.php @@ -16,8 +16,9 @@ class Import /** * @param \Magento\Catalog\Model\Indexer\Category\Product\Processor $indexerCategoryProductProcessor */ - public function __construct(\Magento\Catalog\Model\Indexer\Category\Product\Processor $indexerCategoryProductProcessor) - { + public function __construct( + \Magento\Catalog\Model\Indexer\Category\Product\Processor $indexerCategoryProductProcessor + ) { $this->_indexerCategoryProductProcessor = $indexerCategoryProductProcessor; } diff --git a/app/code/Magento/CatalogImportExport/Model/Indexer/Product/Category/Plugin/Import.php b/app/code/Magento/CatalogImportExport/Model/Indexer/Product/Category/Plugin/Import.php index cfb03035889f7..0d0d4ea80530a 100644 --- a/app/code/Magento/CatalogImportExport/Model/Indexer/Product/Category/Plugin/Import.php +++ b/app/code/Magento/CatalogImportExport/Model/Indexer/Product/Category/Plugin/Import.php @@ -16,8 +16,9 @@ class Import /** * @param \Magento\Catalog\Model\Indexer\Product\Category\Processor $indexerProductCategoryProcessor */ - public function __construct(\Magento\Catalog\Model\Indexer\Product\Category\Processor $indexerProductCategoryProcessor) - { + public function __construct( + \Magento\Catalog\Model\Indexer\Product\Category\Processor $indexerProductCategoryProcessor + ) { $this->_indexerProductCategoryProcessor = $indexerProductCategoryProcessor; } diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php index 0078cb5bcca9a..5ea290a05784f 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php @@ -5,7 +5,15 @@ */ namespace Magento\CatalogImportExport\Test\Unit\Model\Import; +use Magento\CatalogImportExport\Model\Import\Product; +use Magento\CatalogImportExport\Model\Import\Product\CategoryProcessor; +use Magento\CatalogImportExport\Model\Import\Product\StoreResolver; +use Magento\CatalogImportExport\Model\Import\Product\TaxClassProcessor; +use Magento\CatalogInventory\Model\ResourceModel\Stock\ItemFactory; +use Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Model\ResourceModel\Db\ObjectRelationProcessor; +use Magento\Framework\Model\ResourceModel\Db\TransactionManagerInterface; use Magento\Framework\Stdlib\DateTime; use Magento\ImportExport\Model\Import; @@ -90,7 +98,7 @@ class ProductTest extends \Magento\ImportExport\Test\Unit\Model\Import\AbstractI protected $_resourceFactory; // @codingStandardsIgnoreStart - /** @var \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject */ + /** @var CollectionFactory|\PHPUnit_Framework_MockObject_MockObject */ protected $_setColFactory; /** @var \Magento\CatalogImportExport\Model\Import\Product\Type\Factory|\PHPUnit_Framework_MockObject_MockObject */ @@ -111,7 +119,7 @@ class ProductTest extends \Magento\ImportExport\Test\Unit\Model\Import\AbstractI /** @var \Magento\Framework\Filesystem\Directory\WriteInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $_mediaDirectory; - /** @var \Magento\CatalogInventory\Model\ResourceModel\Stock\ItemFactory|\PHPUnit_Framework_MockObject_MockObject */ + /** @var ItemFactory|\PHPUnit_Framework_MockObject_MockObject */ protected $_stockResItemFac; /** @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject */ @@ -123,29 +131,29 @@ class ProductTest extends \Magento\ImportExport\Test\Unit\Model\Import\AbstractI /** @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $_logger; - /** @var \Magento\CatalogImportExport\Model\Import\Product\StoreResolver|\PHPUnit_Framework_MockObject_MockObject */ + /** @var StoreResolver|\PHPUnit_Framework_MockObject_MockObject */ protected $storeResolver; /** @var \Magento\CatalogImportExport\Model\Import\Product\SkuProcessor|\PHPUnit_Framework_MockObject_MockObject */ protected $skuProcessor; - /** @var \Magento\CatalogImportExport\Model\Import\Product\CategoryProcessor|\PHPUnit_Framework_MockObject_MockObject */ + /** @var CategoryProcessor|\PHPUnit_Framework_MockObject_MockObject */ protected $categoryProcessor; /** @var \Magento\CatalogImportExport\Model\Import\Product\Validator|\PHPUnit_Framework_MockObject_MockObject */ protected $validator; - /** @var \Magento\Framework\Model\ResourceModel\Db\ObjectRelationProcessor|\PHPUnit_Framework_MockObject_MockObject */ + /** @var ObjectRelationProcessor|\PHPUnit_Framework_MockObject_MockObject */ protected $objectRelationProcessor; - /** @var \Magento\Framework\Model\ResourceModel\Db\TransactionManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ + /** @var TransactionManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $transactionManager; - /** @var \Magento\CatalogImportExport\Model\Import\Product\TaxClassProcessor|\PHPUnit_Framework_MockObject_MockObject */ + /** @var TaxClassProcessor|\PHPUnit_Framework_MockObject_MockObject */ // @codingStandardsIgnoreEnd protected $taxClassProcessor; - /** @var \Magento\CatalogImportExport\Model\Import\Product */ + /** @var Product */ protected $importProduct; /** @@ -235,7 +243,7 @@ protected function setUp() false ); $this->_setColFactory = $this->getMock( - \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory::class, + CollectionFactory::class, ['create'], [], '', @@ -277,7 +285,7 @@ protected function setUp() $this->getMockBuilder(\Magento\Framework\Filesystem\Directory\WriteInterface::class) ->getMock(); $this->_stockResItemFac = $this->getMock( - \Magento\CatalogInventory\Model\ResourceModel\Stock\ItemFactory::class, + ItemFactory::class, ['create'], [], '', @@ -298,7 +306,7 @@ protected function setUp() $this->getMockBuilder(\Psr\Log\LoggerInterface::class) ->getMock(); $this->storeResolver = - $this->getMockBuilder(\Magento\CatalogImportExport\Model\Import\Product\StoreResolver::class) + $this->getMockBuilder(StoreResolver::class) ->setMethods([ 'getStoreCodeToId', ]) @@ -314,7 +322,7 @@ protected function setUp() $reflectionProperty->setValue($this->skuProcessor, $metadataPoolMock); $this->categoryProcessor = - $this->getMockBuilder(\Magento\CatalogImportExport\Model\Import\Product\CategoryProcessor::class) + $this->getMockBuilder(CategoryProcessor::class) ->disableOriginalConstructor() ->getMock(); $this->validator = @@ -323,15 +331,15 @@ protected function setUp() ->disableOriginalConstructor() ->getMock(); $this->objectRelationProcessor = - $this->getMockBuilder(\Magento\Framework\Model\ResourceModel\Db\ObjectRelationProcessor::class) + $this->getMockBuilder(ObjectRelationProcessor::class) ->disableOriginalConstructor() ->getMock(); $this->transactionManager = - $this->getMockBuilder(\Magento\Framework\Model\ResourceModel\Db\TransactionManagerInterface::class) + $this->getMockBuilder(TransactionManagerInterface::class) ->getMock(); $this->taxClassProcessor = - $this->getMockBuilder(\Magento\CatalogImportExport\Model\Import\Product\TaxClassProcessor::class) + $this->getMockBuilder(TaxClassProcessor::class) ->disableOriginalConstructor() ->getMock(); @@ -356,7 +364,7 @@ protected function setUp() $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->importProduct = $objectManager->getObject( - \Magento\CatalogImportExport\Model\Import\Product::class, + Product::class, [ 'jsonHelper' => $this->jsonHelper, 'importExportData' => $this->importExportData, @@ -397,7 +405,7 @@ protected function setUp() 'data' => $this->data ] ); - $reflection = new \ReflectionClass(\Magento\CatalogImportExport\Model\Import\Product::class); + $reflection = new \ReflectionClass(Product::class); $reflectionProperty = $reflection->getProperty('metadataPool'); $reflectionProperty->setAccessible(true); $reflectionProperty->setValue($this->importProduct, $metadataPoolMock); @@ -627,7 +635,7 @@ public function testGetMultipleValueSeparatorFromParameters() public function testDeleteProductsForReplacement() { - $importProduct = $this->getMockBuilder(\Magento\CatalogImportExport\Model\Import\Product::class) + $importProduct = $this->getMockBuilder(Product::class) ->disableOriginalConstructor() ->setMethods([ 'setParameters', '_deleteProducts' @@ -693,7 +701,7 @@ public function testValidateRowIsAlreadyValidated() */ public function testValidateRow($rowScope, $oldSku, $expectedResult, $behaviour = Import::BEHAVIOR_DELETE) { - $importProduct = $this->getMockBuilder(\Magento\CatalogImportExport\Model\Import\Product::class) + $importProduct = $this->getMockBuilder(Product::class) ->disableOriginalConstructor() ->setMethods(['getBehavior', 'getRowScope', 'getErrorAggregator']) ->getMock(); @@ -705,7 +713,7 @@ public function testValidateRow($rowScope, $oldSku, $expectedResult, $behaviour ->method('getErrorAggregator') ->willReturn($this->getErrorAggregatorObject()); $importProduct->expects($this->once())->method('getRowScope')->willReturn($rowScope); - $skuKey = \Magento\CatalogImportExport\Model\Import\Product::COL_SKU; + $skuKey = Product::COL_SKU; $rowData = [ $skuKey => 'sku', ]; @@ -717,7 +725,7 @@ public function testValidateRow($rowScope, $oldSku, $expectedResult, $behaviour public function testValidateRowDeleteBehaviourAddRowErrorCall() { - $importProduct = $this->getMockBuilder(\Magento\CatalogImportExport\Model\Import\Product::class) + $importProduct = $this->getMockBuilder(Product::class) ->disableOriginalConstructor() ->setMethods(['getBehavior', 'getRowScope', 'addRowError']) ->getMock(); @@ -725,10 +733,10 @@ public function testValidateRowDeleteBehaviourAddRowErrorCall() $importProduct->expects($this->exactly(2))->method('getBehavior') ->willReturn(\Magento\ImportExport\Model\Import::BEHAVIOR_DELETE); $importProduct->expects($this->once())->method('getRowScope') - ->willReturn(\Magento\CatalogImportExport\Model\Import\Product::SCOPE_DEFAULT); + ->willReturn(Product::SCOPE_DEFAULT); $importProduct->expects($this->once())->method('addRowError'); $rowData = [ - \Magento\CatalogImportExport\Model\Import\Product::COL_SKU => 'sku', + Product::COL_SKU => 'sku', ]; $importProduct->validateRow($rowData, 0); @@ -739,7 +747,7 @@ public function testValidateRowValidatorCheck() $messages = ['validator message']; $this->validator->expects($this->once())->method('getMessages')->willReturn($messages); $rowData = [ - \Magento\CatalogImportExport\Model\Import\Product::COL_SKU => 'sku', + Product::COL_SKU => 'sku', ]; $rowNum = 0; $this->importProduct->validateRow($rowData, $rowNum); @@ -838,7 +846,7 @@ public function getStoreIdByCodeDataProvider() return [ [ '$storeCode' => null, - '$expectedResult' => \Magento\CatalogImportExport\Model\Import\Product::SCOPE_DEFAULT, + '$expectedResult' => Product::SCOPE_DEFAULT, ], [ '$storeCode' => 'value', @@ -859,8 +867,8 @@ public function testValidateRowCheckSpecifiedSku($sku, $expectedError) $rowNum = 0; $rowData = [ - \Magento\CatalogImportExport\Model\Import\Product::COL_SKU => $sku, - \Magento\CatalogImportExport\Model\Import\Product::COL_STORE => '', + Product::COL_SKU => $sku, + Product::COL_STORE => '', ]; $this->storeResolver->expects($this->any())->method('getStoreCodeToId')->willReturn(null); @@ -872,7 +880,7 @@ public function testValidateRowCheckSpecifiedSku($sku, $expectedError) $importProduct ->expects($this->once()) ->method('getRowScope') - ->willReturn(\Magento\CatalogImportExport\Model\Import\Product::SCOPE_STORE); + ->willReturn(Product::SCOPE_STORE); $importProduct->expects($this->at(1))->method('addRowError')->with($expectedError, $rowNum)->willReturn(null); $importProduct->validateRow($rowData, $rowNum); @@ -886,7 +894,7 @@ public function testValidateRowProcessEntityIncrement() $errorAggregator->method('isRowInvalid')->willReturn(true); $this->setPropertyValue($this->importProduct, '_processedEntitiesCount', $count); $this->setPropertyValue($this->importProduct, 'errorAggregator', $errorAggregator); - $rowData = [\Magento\CatalogImportExport\Model\Import\Product::COL_SKU => false]; + $rowData = [Product::COL_SKU => false]; //suppress validator $this->_setValidatorMockInImportProduct($this->importProduct); $this->importProduct->validateRow($rowData, $rowNum); @@ -903,7 +911,7 @@ public function testValidateRowValidateExistingProductTypeAddNewSku() $sku = 'sku'; $rowNum = 0; $rowData = [ - \Magento\CatalogImportExport\Model\Import\Product::COL_SKU => $sku, + Product::COL_SKU => $sku, ]; $oldSku = [ $sku => [ @@ -944,7 +952,7 @@ public function testValidateRowValidateExistingProductTypeAddErrorRowCall() $sku = 'sku'; $rowNum = 0; $rowData = [ - \Magento\CatalogImportExport\Model\Import\Product::COL_SKU => $sku, + Product::COL_SKU => $sku, ]; $oldSku = [ $sku => [ @@ -972,7 +980,7 @@ public function testValidateRowValidateExistingProductTypeResetSku() $sku = 'sku'; $rowNum = 0; $rowData = [ - \Magento\CatalogImportExport\Model\Import\Product::COL_SKU => $sku, + Product::COL_SKU => $sku, ]; $oldSku = [ $sku => [ @@ -1018,15 +1026,15 @@ public function testValidateRowValidateNewProductTypeAddRowErrorCall( $sku = 'sku'; $rowNum = 0; $rowData = [ - \Magento\CatalogImportExport\Model\Import\Product::COL_SKU => $sku, - \Magento\CatalogImportExport\Model\Import\Product::COL_TYPE => $colType, - \Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET => $colAttrSet, + Product::COL_SKU => $sku, + Product::COL_TYPE => $colType, + Product::COL_ATTR_SET => $colAttrSet, ]; $_attrSetNameToId = [ - $rowData[\Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET] => $attrSetNameToIdColAttrSet, + $rowData[Product::COL_ATTR_SET] => $attrSetNameToIdColAttrSet, ]; $_productTypeModels = [ - $rowData[\Magento\CatalogImportExport\Model\Import\Product::COL_TYPE] => $productTypeModelsColType, + $rowData[Product::COL_TYPE] => $productTypeModelsColType, ]; $oldSku = [ $sku => null, @@ -1054,25 +1062,25 @@ public function testValidateRowValidateNewProductTypeGetNewSkuCall() $sku = 'sku'; $rowNum = 0; $rowData = [ - \Magento\CatalogImportExport\Model\Import\Product::COL_SKU => $sku, - \Magento\CatalogImportExport\Model\Import\Product::COL_TYPE => 'value', - \Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET => 'value', + Product::COL_SKU => $sku, + Product::COL_TYPE => 'value', + Product::COL_ATTR_SET => 'value', ]; $_productTypeModels = [ - $rowData[\Magento\CatalogImportExport\Model\Import\Product::COL_TYPE] => 'value', + $rowData[Product::COL_TYPE] => 'value', ]; $oldSku = [ $sku => null, ]; $_attrSetNameToId = [ - $rowData[\Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET] => 'attr_set_code_val' + $rowData[Product::COL_ATTR_SET] => 'attr_set_code_val' ]; $expectedData = [ 'entity_id' => null, - 'type_id' => $rowData[\Magento\CatalogImportExport\Model\Import\Product::COL_TYPE],//value + 'type_id' => $rowData[Product::COL_TYPE],//value //attr_set_id_val - 'attr_set_id' => $_attrSetNameToId[$rowData[\Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET]], - 'attr_set_code' => $rowData[\Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET],//value + 'attr_set_id' => $_attrSetNameToId[$rowData[Product::COL_ATTR_SET]], + 'attr_set_code' => $rowData[Product::COL_ATTR_SET],//value 'row_id' => null ]; $importProduct = $this->createModelMockWithErrorAggregator( @@ -1098,9 +1106,9 @@ public function testValidateRowValidateNewProductTypeResetSku() $sku = 'sku'; $rowNum = 0; $rowData = [ - \Magento\CatalogImportExport\Model\Import\Product::COL_SKU => $sku, - \Magento\CatalogImportExport\Model\Import\Product::COL_TYPE => 'value', - \Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET => 'value', + Product::COL_SKU => $sku, + Product::COL_TYPE => 'value', + Product::COL_ATTR_SET => 'value', ]; $oldSku = [ @@ -1109,10 +1117,10 @@ public function testValidateRowValidateNewProductTypeResetSku() ], ]; $_productTypeModels = [ - $rowData[\Magento\CatalogImportExport\Model\Import\Product::COL_TYPE] => 'value', + $rowData[Product::COL_TYPE] => 'value', ]; $_attrSetNameToId = [ - $rowData[\Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET] => 'attr_set_code_val' + $rowData[Product::COL_ATTR_SET] => 'attr_set_code_val' ]; $importProduct = $this->createModelMockWithErrorAggregator( @@ -1155,19 +1163,19 @@ public function testValidateDefaultScopeNotValidAttributesResetSku() $this->setPropertyValue($this->importProduct, 'string', $stringUtilsMock); $scopeMock = $this->getMock( - \Magento\CatalogImportExport\Model\Import\Product::class, + Product::class, ['getRowScope'], [], '', false ); - $colStore = \Magento\CatalogImportExport\Model\Import\Product::COL_STORE; + $colStore = Product::COL_STORE; $scopeRowData = [ $sku => 'sku', $colStore => null, ]; - $scopeResult = \Magento\CatalogImportExport\Model\Import\Product::SCOPE_DEFAULT; + $scopeResult = Product::SCOPE_DEFAULT; $scopeMock->expects($this->any())->method('getRowScope')->with($scopeRowData)->willReturn($scopeResult); $oldSku = [ $sku => [ @@ -1191,7 +1199,7 @@ public function testValidateDefaultScopeNotValidAttributesResetSku() $attrRowData = [ 'code' => str_repeat( 'a', - \Magento\CatalogImportExport\Model\Import\Product::DB_MAX_VARCHAR_LENGTH + 1 + Product::DB_MAX_VARCHAR_LENGTH + 1 ), ]; @@ -1208,8 +1216,8 @@ public function testValidateRowSetAttributeSetCodeIntoRowData() $sku = 'sku'; $rowNum = 0; $rowData = [ - \Magento\CatalogImportExport\Model\Import\Product::COL_SKU => $sku, - \Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET => 'col_attr_set_val', + Product::COL_SKU => $sku, + Product::COL_ATTR_SET => 'col_attr_set_val', ]; $expectedAttrSetCode = 'new_attr_set_code'; $newSku = [ @@ -1217,8 +1225,8 @@ public function testValidateRowSetAttributeSetCodeIntoRowData() 'type_id' => 'new_type_id_val', ]; $expectedRowData = [ - \Magento\CatalogImportExport\Model\Import\Product::COL_SKU => $sku, - \Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET => $newSku['attr_set_code'], + Product::COL_SKU => $sku, + Product::COL_ATTR_SET => $newSku['attr_set_code'], ]; $oldSku = [ $sku => [ @@ -1252,8 +1260,8 @@ public function testValidateValidateOptionEntity() $sku = 'sku'; $rowNum = 0; $rowData = [ - \Magento\CatalogImportExport\Model\Import\Product::COL_SKU => $sku, - \Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET => 'col_attr_set_val', + Product::COL_SKU => $sku, + Product::COL_ATTR_SET => 'col_attr_set_val', ]; $oldSku = [ $sku => [ @@ -1434,7 +1442,7 @@ public function validateRowDataProvider() { return [ [ - '$rowScope' => \Magento\CatalogImportExport\Model\Import\Product::SCOPE_DEFAULT, + '$rowScope' => Product::SCOPE_DEFAULT, '$oldSku' => null, '$expectedResult' => false, ], @@ -1449,12 +1457,12 @@ public function validateRowDataProvider() '$expectedResult' => true, ], [ - '$rowScope' => \Magento\CatalogImportExport\Model\Import\Product::SCOPE_DEFAULT, + '$rowScope' => Product::SCOPE_DEFAULT, '$oldSku' => true, '$expectedResult' => true, ], [ - '$rowScope' => \Magento\CatalogImportExport\Model\Import\Product::SCOPE_DEFAULT, + '$rowScope' => Product::SCOPE_DEFAULT, '$oldSku' => null, '$expectedResult' => false, '$behaviour' => Import::BEHAVIOR_REPLACE @@ -1475,7 +1483,7 @@ public function isAttributeValidAssertAttrValidDataProvider() '$rowData' => [ 'code' => str_repeat( 'a', - \Magento\CatalogImportExport\Model\Import\Product::DB_MAX_VARCHAR_LENGTH - 1 + Product::DB_MAX_VARCHAR_LENGTH - 1 ), ], ], @@ -1528,7 +1536,7 @@ public function isAttributeValidAssertAttrValidDataProvider() '$rowData' => [ 'code' => str_repeat( 'a', - \Magento\CatalogImportExport\Model\Import\Product::DB_MAX_TEXT_LENGTH - 1 + Product::DB_MAX_TEXT_LENGTH - 1 ), ], ], @@ -1548,7 +1556,7 @@ public function isAttributeValidAssertAttrInvalidDataProvider() '$rowData' => [ 'code' => str_repeat( 'a', - \Magento\CatalogImportExport\Model\Import\Product::DB_MAX_VARCHAR_LENGTH + 1 + Product::DB_MAX_VARCHAR_LENGTH + 1 ), ], ], @@ -1601,7 +1609,7 @@ public function isAttributeValidAssertAttrInvalidDataProvider() '$rowData' => [ 'code' => str_repeat( 'a', - \Magento\CatalogImportExport\Model\Import\Product::DB_MAX_TEXT_LENGTH + 1 + Product::DB_MAX_TEXT_LENGTH + 1 ), ], ], @@ -1613,8 +1621,8 @@ public function isAttributeValidAssertAttrInvalidDataProvider() */ public function getRowScopeDataProvider() { - $colSku = \Magento\CatalogImportExport\Model\Import\Product::COL_SKU; - $colStore = \Magento\CatalogImportExport\Model\Import\Product::COL_STORE; + $colSku = Product::COL_SKU; + $colStore = Product::COL_STORE; return [ [ @@ -1622,21 +1630,21 @@ public function getRowScopeDataProvider() $colSku => null, $colStore => 'store', ], - '$expectedResult' => \Magento\CatalogImportExport\Model\Import\Product::SCOPE_STORE + '$expectedResult' => Product::SCOPE_STORE ], [ '$rowData' => [ $colSku => 'sku', $colStore => null, ], - '$expectedResult' => \Magento\CatalogImportExport\Model\Import\Product::SCOPE_DEFAULT + '$expectedResult' => Product::SCOPE_DEFAULT ], [ '$rowData' => [ $colSku => 'sku', $colStore => 'store', ], - '$expectedResult' => \Magento\CatalogImportExport\Model\Import\Product::SCOPE_STORE + '$expectedResult' => Product::SCOPE_STORE ], ]; } @@ -1768,7 +1776,7 @@ private function _rewriteGetOptionEntityInImportProduct($importProduct) protected function createModelMockWithErrorAggregator(array $methods = [], array $errorAggregatorMethods = []) { $methods[] = 'getErrorAggregator'; - $importProduct = $this->getMockBuilder(\Magento\CatalogImportExport\Model\Import\Product::class) + $importProduct = $this->getMockBuilder(Product::class) ->disableOriginalConstructor() ->setMethods($methods) ->getMock(); diff --git a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Item/StockItemCriteria.php b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Item/StockItemCriteria.php index 0484065c42b48..b3898f2c3a3eb 100644 --- a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Item/StockItemCriteria.php +++ b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Item/StockItemCriteria.php @@ -18,7 +18,7 @@ class StockItemCriteria extends AbstractCriteria implements \Magento\CatalogInve */ public function __construct($mapper = '') { - $this->mapperInterfaceName = $mapper ?: \Magento\CatalogInventory\Model\ResourceModel\Stock\Item\StockItemCriteriaMapper::class; + $this->mapperInterfaceName = $mapper ?: StockItemCriteriaMapper::class; $this->data['initial_condition'] = true; } diff --git a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status/StockStatusCriteria.php b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status/StockStatusCriteria.php index 828c16ba75635..c30d0d43287f8 100644 --- a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status/StockStatusCriteria.php +++ b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status/StockStatusCriteria.php @@ -18,7 +18,7 @@ class StockStatusCriteria extends AbstractCriteria implements \Magento\CatalogIn */ public function __construct($mapper = '') { - $this->mapperInterfaceName = $mapper ?: \Magento\CatalogInventory\Model\ResourceModel\Stock\Status\StockStatusCriteriaMapper::class; + $this->mapperInterfaceName = $mapper ?: StockStatusCriteriaMapper::class; $this->data['initial_condition'] = true; } diff --git a/app/code/Magento/CatalogInventory/Model/StockIndex.php b/app/code/Magento/CatalogInventory/Model/StockIndex.php index ab12ec3f0e25e..8104737adb6b5 100644 --- a/app/code/Magento/CatalogInventory/Model/StockIndex.php +++ b/app/code/Magento/CatalogInventory/Model/StockIndex.php @@ -7,6 +7,7 @@ namespace Magento\CatalogInventory\Model; use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; use Magento\Catalog\Model\Product\Type as ProductType; use Magento\Catalog\Model\Product\Website as ProductWebsite; use Magento\CatalogInventory\Api\StockIndexInterface; @@ -173,7 +174,7 @@ protected function processChildren( if (isset($childrenStatus[$childId]) && isset($childrenWebsites[$childId]) && in_array($websiteId, $childrenWebsites[$childId]) - && $childrenStatus[$childId] == \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED + && $childrenStatus[$childId] == Status::STATUS_ENABLED && isset($childrenStock[$childId]) && $childrenStock[$childId] == \Magento\CatalogInventory\Model\Stock\Status::STATUS_IN_STOCK ) { @@ -204,7 +205,7 @@ protected function getWebsitesWithDefaultStores($websiteId = null) $this->websites = $resource->getWebsiteStores(); } $websites = $this->websites; - if ($websiteId !== null&& isset($this->websites[$websiteId])) { + if ($websiteId !== null && isset($this->websites[$websiteId])) { $websites = [$websiteId => $this->websites[$websiteId]]; } return $websites; diff --git a/app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php b/app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php index 82755808ee8e8..5f3ae9897334a 100644 --- a/app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php @@ -6,12 +6,14 @@ namespace Magento\CatalogSearch\Model\ResourceModel\Search; +use Magento\Search\Model\SearchCollectionInterface; + /** * Search collection * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection implements \Magento\Search\Model\SearchCollectionInterface +class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection implements SearchCollectionInterface { /** * Attribute collection diff --git a/app/code/Magento/CatalogUrlRewrite/Observer/UrlRewriteHandler.php b/app/code/Magento/CatalogUrlRewrite/Observer/UrlRewriteHandler.php index b82a22eb0fcce..3106f28e4606f 100644 --- a/app/code/Magento/CatalogUrlRewrite/Observer/UrlRewriteHandler.php +++ b/app/code/Magento/CatalogUrlRewrite/Observer/UrlRewriteHandler.php @@ -5,15 +5,18 @@ */ namespace Magento\CatalogUrlRewrite\Observer; +use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator; +use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator; + class UrlRewriteHandler { /** @var \Magento\CatalogUrlRewrite\Model\Category\ChildrenCategoriesProvider */ protected $childrenCategoriesProvider; - /** @var \Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator */ + /** @var CategoryUrlRewriteGenerator */ protected $categoryUrlRewriteGenerator; - /** @var \Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator */ + /** @var ProductUrlRewriteGenerator */ protected $productUrlRewriteGenerator; /** @var \Magento\UrlRewrite\Model\UrlPersistInterface */ @@ -36,8 +39,8 @@ class UrlRewriteHandler /** * @param \Magento\CatalogUrlRewrite\Model\Category\ChildrenCategoriesProvider $childrenCategoriesProvider - * @param \Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator $categoryUrlRewriteGenerator - * @param \Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator $productUrlRewriteGenerator + * @param CategoryUrlRewriteGenerator $categoryUrlRewriteGenerator + * @param ProductUrlRewriteGenerator $productUrlRewriteGenerator * @param \Magento\UrlRewrite\Model\UrlPersistInterface $urlPersist * @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory * @param \Magento\UrlRewrite\Model\MergeDataProviderFactory|null $mergeDataProviderFactory @@ -45,8 +48,8 @@ class UrlRewriteHandler */ public function __construct( \Magento\CatalogUrlRewrite\Model\Category\ChildrenCategoriesProvider $childrenCategoriesProvider, - \Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator $categoryUrlRewriteGenerator, - \Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator $productUrlRewriteGenerator, + CategoryUrlRewriteGenerator $categoryUrlRewriteGenerator, + ProductUrlRewriteGenerator $productUrlRewriteGenerator, \Magento\UrlRewrite\Model\UrlPersistInterface $urlPersist, \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory, \Magento\UrlRewrite\Model\MergeDataProviderFactory $mergeDataProviderFactory = null, @@ -186,13 +189,16 @@ public function deleteCategoryRewritesForChildren(\Magento\Catalog\Model\Categor $this->urlPersist->deleteByData( [ \Magento\UrlRewrite\Service\V1\Data\UrlRewrite::ENTITY_ID => $categoryId, - \Magento\UrlRewrite\Service\V1\Data\UrlRewrite::ENTITY_TYPE => \Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator::ENTITY_TYPE, + \Magento\UrlRewrite\Service\V1\Data\UrlRewrite::ENTITY_TYPE + => CategoryUrlRewriteGenerator::ENTITY_TYPE, ] ); $this->urlPersist->deleteByData( [ - \Magento\UrlRewrite\Service\V1\Data\UrlRewrite::METADATA => $this->serializer->serialize(['category_id' => $categoryId]), - \Magento\UrlRewrite\Service\V1\Data\UrlRewrite::ENTITY_TYPE => \Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator::ENTITY_TYPE, + \Magento\UrlRewrite\Service\V1\Data\UrlRewrite::METADATA + => $this->serializer->serialize(['category_id' => $categoryId]), + \Magento\UrlRewrite\Service\V1\Data\UrlRewrite::ENTITY_TYPE + => ProductUrlRewriteGenerator::ENTITY_TYPE, ] ); } diff --git a/app/code/Magento/Cms/Block/Block.php b/app/code/Magento/Cms/Block/Block.php index ea6139cc347d6..7a850145cde2f 100644 --- a/app/code/Magento/Cms/Block/Block.php +++ b/app/code/Magento/Cms/Block/Block.php @@ -6,10 +6,12 @@ namespace Magento\Cms\Block; +use Magento\Framework\DataObject\IdentityInterface; + /** * Cms block content block */ -class Block extends \Magento\Framework\View\Element\AbstractBlock implements \Magento\Framework\DataObject\IdentityInterface +class Block extends \Magento\Framework\View\Element\AbstractBlock implements IdentityInterface { /** * @var \Magento\Cms\Model\Template\FilterProvider diff --git a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage/Collection.php b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage/Collection.php index 7cd113ab33b0a..88d440cfa84ae 100644 --- a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage/Collection.php +++ b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage/Collection.php @@ -24,8 +24,10 @@ class Collection extends \Magento\Framework\Data\Collection\Filesystem * @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory * @param \Magento\Framework\Filesystem $filesystem */ - public function __construct(\Magento\Framework\Data\Collection\EntityFactory $entityFactory, \Magento\Framework\Filesystem $filesystem) - { + public function __construct( + \Magento\Framework\Data\Collection\EntityFactory $entityFactory, + \Magento\Framework\Filesystem $filesystem + ) { $this->_filesystem = $filesystem; parent::__construct($entityFactory); } diff --git a/app/code/Magento/Config/Block/System/Config/Form/Field.php b/app/code/Magento/Config/Block/System/Config/Form/Field.php index 5a58c6acdc737..bbbc6bcd8d97e 100644 --- a/app/code/Magento/Config/Block/System/Config/Form/Field.php +++ b/app/code/Magento/Config/Block/System/Config/Form/Field.php @@ -12,13 +12,15 @@ */ namespace Magento\Config\Block\System\Config\Form; +use Magento\Framework\Data\Form\Element\Renderer\RendererInterface; + /** * Render field html element in Stores Configuration * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.NumberOfChildren) */ -class Field extends \Magento\Backend\Block\Template implements \Magento\Framework\Data\Form\Element\Renderer\RendererInterface +class Field extends \Magento\Backend\Block\Template implements RendererInterface { /** * Retrieve element HTML markup diff --git a/app/code/Magento/Config/Block/System/Config/Form/Field/FieldArray/AbstractFieldArray.php b/app/code/Magento/Config/Block/System/Config/Form/Field/FieldArray/AbstractFieldArray.php index 27e64081d5d07..2aaaf5a4bc75b 100644 --- a/app/code/Magento/Config/Block/System/Config/Form/Field/FieldArray/AbstractFieldArray.php +++ b/app/code/Magento/Config/Block/System/Config/Form/Field/FieldArray/AbstractFieldArray.php @@ -82,7 +82,9 @@ public function addColumn($name, $params) 'class' => $this->_getParam($params, 'class'), 'renderer' => false, ]; - if (!empty($params['renderer']) && $params['renderer'] instanceof \Magento\Framework\View\Element\AbstractBlock) { + if (!empty($params['renderer']) + && $params['renderer'] instanceof \Magento\Framework\View\Element\AbstractBlock + ) { $this->_columns[$name]['renderer'] = $params['renderer']; } } diff --git a/app/code/Magento/Config/Model/Config/Structure/Mapper/Factory.php b/app/code/Magento/Config/Model/Config/Structure/Mapper/Factory.php index eadd811564853..1647328d90d65 100644 --- a/app/code/Magento/Config/Model/Config/Structure/Mapper/Factory.php +++ b/app/code/Magento/Config/Model/Config/Structure/Mapper/Factory.php @@ -36,7 +36,7 @@ class Factory self::MAPPER_PATH => \Magento\Config\Model\Config\Structure\Mapper\Path::class, self::MAPPER_IGNORE => \Magento\Config\Model\Config\Structure\Mapper\Ignore::class, self::MAPPER_DEPENDENCIES => \Magento\Config\Model\Config\Structure\Mapper\Dependencies::class, - self::MAPPER_ATTRIBUTE_INHERITANCE => \Magento\Config\Model\Config\Structure\Mapper\Attribute\Inheritance::class, + self::MAPPER_ATTRIBUTE_INHERITANCE => Attribute\Inheritance::class, self::MAPPER_EXTENDS => \Magento\Config\Model\Config\Structure\Mapper\ExtendsMapper::class, ]; diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/Structure/Element/FieldTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/Element/FieldTest.php index 63fcaea870167..d7cd8dc3c6d71 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Config/Structure/Element/FieldTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/Element/FieldTest.php @@ -324,7 +324,8 @@ public function testGetOptionsWithConstantValOptions() $option = [ [ 'label' => 'test', - 'value' => "{{\Magento\Config\Test\Unit\Model\Config\Structure\Element\FieldTest::FIELD_TEST_CONSTANT}}", + 'value' => + "{{\Magento\Config\Test\Unit\Model\Config\Structure\Element\FieldTest::FIELD_TEST_CONSTANT}}", ], ]; $expected = [ diff --git a/app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php b/app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php index 6362efdd9bcbe..1b673f2254871 100644 --- a/app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php +++ b/app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ +use Magento\Config\Model\Config\Backend\Encrypted; + return [ 'config' => [ 'noNamespaceSchemaLocation' => 'urn:magento:module:Magento_Config:etc/system_file.xsd', @@ -34,7 +36,7 @@ 'showInWebsite' => '1', 'type' => 'text', 'label' => 'Field 2', - 'backend_model' => \Magento\Config\Model\Config\Backend\Encrypted::class, + 'backend_model' => Encrypted::class, '_elementType' => 'field', ], ], @@ -75,7 +77,7 @@ 'id' => 'field_3_1_1', 'translate' => 'label', 'showInWebsite' => '1', - 'backend_model' => \Magento\Config\Model\Config\Backend\Encrypted::class, + 'backend_model' => Encrypted::class, 'type' => 'text', 'label' => 'Field 3.1.1', '_elementType' => 'field', @@ -138,7 +140,7 @@ 'showInWebsite' => '1', 'type' => 'text', 'label' => 'Field 4', - 'backend_model' => \Magento\Config\Model\Config\Backend\Encrypted::class, + 'backend_model' => Encrypted::class, 'attribute_1' => 'test_value_1', 'attribute_2' => 'test_value_2', 'attribute_text' => '', diff --git a/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php b/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php index e72d73dc07636..85904310d0301 100644 --- a/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php @@ -835,7 +835,13 @@ public function isRowValid(array $rowData, $rowNum, $isNewProduct = true) if (isset($option['_super_products_sku'])) { if (in_array($option['_super_products_sku'], $skus)) { $error = true; - $this->_entityModel->addRowError(sprintf($this->_messageTemplates[self::ERROR_DUPLICATED_VARIATIONS], $option['_super_products_sku']), $rowNum); + $this->_entityModel->addRowError( + sprintf( + $this->_messageTemplates[self::ERROR_DUPLICATED_VARIATIONS], + $option['_super_products_sku'] + ), + $rowNum + ); } $skus[] = $option['_super_products_sku']; } diff --git a/app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php b/app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php index 3e37109106411..f1af0317aea09 100644 --- a/app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php +++ b/app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Import/Product/Type/ConfigurableTest.php @@ -494,16 +494,25 @@ protected function _getSuperAttributes() public function testSaveData() { $this->_entityModel->expects($this->any())->method('getNewSku')->will($this->returnValue([ - 'configurableskuI22' => [$this->productEntityLinkField => 1, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], - 'testconf2-attr2val1-testattr3v1' => [$this->productEntityLinkField => 2, 'type_id' => 'simple', 'attr_set_code' => 'Default'], - 'testconf2-attr2val1-testattr30v1' => [$this->productEntityLinkField => 20, 'type_id' => 'simple', 'attr_set_code' => 'Default'], - 'testconf2-attr2val1-testattr3v2' => [$this->productEntityLinkField => 3, 'type_id' => 'simple', 'attr_set_code' => 'Default'], + 'configurableskuI22' + => [$this->productEntityLinkField => 1, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], + 'testconf2-attr2val1-testattr3v1' + => [$this->productEntityLinkField => 2, 'type_id' => 'simple', 'attr_set_code' => 'Default'], + 'testconf2-attr2val1-testattr30v1' + => [$this->productEntityLinkField => 20, 'type_id' => 'simple', 'attr_set_code' => 'Default'], + 'testconf2-attr2val1-testattr3v2' + => [$this->productEntityLinkField => 3, 'type_id' => 'simple', 'attr_set_code' => 'Default'], 'testSimple' => [$this->productEntityLinkField => 4, 'type_id' => 'simple', 'attr_set_code' => 'Default'], - 'testSimpleToSkip' => [$this->productEntityLinkField => 5, 'type_id' => 'simple', 'attr_set_code' => 'Default'], - 'configurableskuI22withoutLabels' => [$this->productEntityLinkField => 6, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], - 'configurableskuI22withoutVariations' => [$this->productEntityLinkField => 7, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], - 'configurableskuI22Duplicated' => [$this->productEntityLinkField => 8, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], - 'configurableskuI22BadPrice' => [$this->productEntityLinkField => 9, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], + 'testSimpleToSkip' + => [$this->productEntityLinkField => 5, 'type_id' => 'simple', 'attr_set_code' => 'Default'], + 'configurableskuI22withoutLabels' + => [$this->productEntityLinkField => 6, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], + 'configurableskuI22withoutVariations' + => [$this->productEntityLinkField => 7, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], + 'configurableskuI22Duplicated' + => [$this->productEntityLinkField => 8, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], + 'configurableskuI22BadPrice' + => [$this->productEntityLinkField => 9, 'type_id' => 'configurable', 'attr_set_code' => 'Default'], ])); // at(0) is select() call, quoteIdentifier() is invoked at(1) and at(2) diff --git a/app/code/Magento/Customer/Model/Address/Mapper.php b/app/code/Magento/Customer/Model/Address/Mapper.php index 3d0f675a2fc9f..629673ca7189b 100644 --- a/app/code/Magento/Customer/Model/Address/Mapper.php +++ b/app/code/Magento/Customer/Model/Address/Mapper.php @@ -37,7 +37,11 @@ public function __construct(ExtensibleDataObjectConverter $extensibleDataObjectC */ public function toFlatArray($addressDataObject) { - $flatAddressArray = $this->extensibleDataObjectConverter->toFlatArray($addressDataObject, [], \Magento\Customer\Api\Data\AddressInterface::class); + $flatAddressArray = $this->extensibleDataObjectConverter->toFlatArray( + $addressDataObject, + [], + \Magento\Customer\Api\Data\AddressInterface::class + ); //preserve street $street = $addressDataObject->getStreet(); if (!empty($street) && is_array($street)) { diff --git a/app/code/Magento/Customer/Model/Customer/Mapper.php b/app/code/Magento/Customer/Model/Customer/Mapper.php index af16016471f49..074f49f218f7d 100644 --- a/app/code/Magento/Customer/Model/Customer/Mapper.php +++ b/app/code/Magento/Customer/Model/Customer/Mapper.php @@ -36,7 +36,7 @@ public function __construct(ExtensibleDataObjectConverter $extensibleDataObjectC */ public function toFlatArray(CustomerInterface $customer) { - $flatArray = $this->extensibleDataObjectConverter->toNestedArray($customer, [], \Magento\Customer\Api\Data\CustomerInterface::class); + $flatArray = $this->extensibleDataObjectConverter->toNestedArray($customer, [], CustomerInterface::class); unset($flatArray["addresses"]); return ConvertArray::toFlatArray($flatArray); } diff --git a/app/code/Magento/Customer/Model/ResourceModel/Group/Grid/ServiceCollection.php b/app/code/Magento/Customer/Model/ResourceModel/Group/Grid/ServiceCollection.php index a889206135be6..a86b652f7c7d2 100644 --- a/app/code/Magento/Customer/Model/ResourceModel/Group/Grid/ServiceCollection.php +++ b/app/code/Magento/Customer/Model/ResourceModel/Group/Grid/ServiceCollection.php @@ -69,7 +69,7 @@ public function loadData($printQuery = false, $logQuery = false) $groups = $searchResults->getItems(); foreach ($groups as $group) { $groupItem = new \Magento\Framework\DataObject(); - $groupItem->addData($this->simpleDataObjectConverter->toFlatArray($group, \Magento\Customer\Api\Data\GroupInterface::class)); + $groupItem->addData($this->simpleDataObjectConverter->toFlatArray($group, GroupInterface::class)); $this->_addItem($groupItem); } $this->_setIsLoaded(); diff --git a/app/code/Magento/Customer/Setup/CustomerSetup.php b/app/code/Magento/Customer/Setup/CustomerSetup.php index ad08add91098a..4c478d420b3a4 100644 --- a/app/code/Magento/Customer/Setup/CustomerSetup.php +++ b/app/code/Magento/Customer/Setup/CustomerSetup.php @@ -345,7 +345,8 @@ public function getDefaultEntities() 'attribute_model' => \Magento\Customer\Model\Attribute::class, 'table' => 'customer_address_entity', 'additional_attribute_table' => 'customer_eav_attribute', - 'entity_attribute_collection' => \Magento\Customer\Model\ResourceModel\Address\Attribute\Collection::class, + 'entity_attribute_collection' + => \Magento\Customer\Model\ResourceModel\Address\Attribute\Collection::class, 'attributes' => [ 'prefix' => [ 'type' => 'static', diff --git a/app/code/Magento/Developer/Model/TemplateEngine/Decorator/DebugHints.php b/app/code/Magento/Developer/Model/TemplateEngine/Decorator/DebugHints.php index 905f41570b736..09a9c4c166dc5 100644 --- a/app/code/Magento/Developer/Model/TemplateEngine/Decorator/DebugHints.php +++ b/app/code/Magento/Developer/Model/TemplateEngine/Decorator/DebugHints.php @@ -60,8 +60,14 @@ public function render(\Magento\Framework\View\Element\BlockInterface $block, $t protected function _renderTemplateHints($blockHtml, $templateFile) { return << -
{$templateFile}
+
+
{$templateFile} +
{$blockHtml}
HTML; @@ -78,7 +84,12 @@ protected function _renderBlockHints($blockHtml, \Magento\Framework\View\Element { $blockClass = get_class($block); return <<{$blockClass} +
+ {$blockClass} +
{$blockHtml} HTML; } diff --git a/app/code/Magento/Directory/Model/Country.php b/app/code/Magento/Directory/Model/Country.php index bc94fbc174bcf..653bc3479190c 100644 --- a/app/code/Magento/Directory/Model/Country.php +++ b/app/code/Magento/Directory/Model/Country.php @@ -196,6 +196,7 @@ public function getFormat($type) /** * Get country name * + * @param string|null $locale * @return string */ public function getName($locale = null) diff --git a/app/code/Magento/Directory/Model/Currency/Import/Factory.php b/app/code/Magento/Directory/Model/Currency/Import/Factory.php index 688ad9eec001e..49500002c6fb5 100644 --- a/app/code/Magento/Directory/Model/Currency/Import/Factory.php +++ b/app/code/Magento/Directory/Model/Currency/Import/Factory.php @@ -53,7 +53,8 @@ public function create($serviceName, array $data = []) $serviceInstance = $this->_objectManager->create($serviceClass, $data); if (!$serviceInstance instanceof \Magento\Directory\Model\Currency\Import\ImportInterface) { throw new \UnexpectedValueException( - "Class '{$serviceClass}' has to implement \\Magento\\Directory\\Model\\Currency\\Import\\ImportInterface." + "Class '{$serviceClass}' has to implement " + . "\\Magento\\Directory\\Model\\Currency\\Import\\ImportInterface." ); } return $serviceInstance; diff --git a/app/code/Magento/Downloadable/Block/Catalog/Product/Samples.php b/app/code/Magento/Downloadable/Block/Catalog/Product/Samples.php index 537508e619de8..bd2b80c54726b 100644 --- a/app/code/Magento/Downloadable/Block/Catalog/Product/Samples.php +++ b/app/code/Magento/Downloadable/Block/Catalog/Product/Samples.php @@ -54,7 +54,10 @@ public function getSamplesTitle() if ($this->getProduct()->getSamplesTitle()) { return $this->getProduct()->getSamplesTitle(); } - return $this->_scopeConfig->getValue(\Magento\Downloadable\Model\Sample::XML_PATH_SAMPLES_TITLE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + return $this->_scopeConfig->getValue( + \Magento\Downloadable\Model\Sample::XML_PATH_SAMPLES_TITLE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -65,6 +68,9 @@ public function getSamplesTitle() */ public function getIsOpenInNewWindow() { - return $this->_scopeConfig->isSetFlag(\Magento\Downloadable\Model\Link::XML_PATH_TARGET_NEW_WINDOW, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + return $this->_scopeConfig->isSetFlag( + \Magento\Downloadable\Model\Link::XML_PATH_TARGET_NEW_WINDOW, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } } diff --git a/app/code/Magento/Downloadable/Block/Customer/Products/ListProducts.php b/app/code/Magento/Downloadable/Block/Customer/Products/ListProducts.php index 25e2a69e4c529..dc044e3435b6e 100644 --- a/app/code/Magento/Downloadable/Block/Customer/Products/ListProducts.php +++ b/app/code/Magento/Downloadable/Block/Customer/Products/ListProducts.php @@ -163,6 +163,9 @@ public function getDownloadUrl($item) */ public function getIsOpenInNewWindow() { - return $this->_scopeConfig->isSetFlag(\Magento\Downloadable\Model\Link::XML_PATH_TARGET_NEW_WINDOW, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + return $this->_scopeConfig->isSetFlag( + \Magento\Downloadable\Model\Link::XML_PATH_TARGET_NEW_WINDOW, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } } diff --git a/app/code/Magento/Downloadable/Controller/Customer/Products.php b/app/code/Magento/Downloadable/Controller/Customer/Products.php index 9162994b0c772..004725ae00bd4 100644 --- a/app/code/Magento/Downloadable/Controller/Customer/Products.php +++ b/app/code/Magento/Downloadable/Controller/Customer/Products.php @@ -20,8 +20,10 @@ class Products extends \Magento\Framework\App\Action\Action * @param \Magento\Framework\App\Action\Context $context * @param \Magento\Customer\Model\Session $customerSession */ - public function __construct(\Magento\Framework\App\Action\Context $context, \Magento\Customer\Model\Session $customerSession) - { + public function __construct( + \Magento\Framework\App\Action\Context $context, + \Magento\Customer\Model\Session $customerSession + ) { $this->_customerSession = $customerSession; parent::__construct($context); } diff --git a/app/code/Magento/Downloadable/Helper/Catalog/Product/Configuration.php b/app/code/Magento/Downloadable/Helper/Catalog/Product/Configuration.php index 3d3c72d994c9b..a9f5ead86578c 100644 --- a/app/code/Magento/Downloadable/Helper/Catalog/Product/Configuration.php +++ b/app/code/Magento/Downloadable/Helper/Catalog/Product/Configuration.php @@ -67,7 +67,10 @@ public function getLinksTitle($product) if (strlen($title)) { return $title; } - return $this->scopeConfig->getValue(\Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + return $this->scopeConfig->getValue( + \Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** diff --git a/app/code/Magento/Downloadable/Helper/Download.php b/app/code/Magento/Downloadable/Helper/Download.php index d1b6e8c0bc9dc..05320c4509d51 100644 --- a/app/code/Magento/Downloadable/Helper/Download.php +++ b/app/code/Magento/Downloadable/Helper/Download.php @@ -280,6 +280,10 @@ public function output() */ public function getContentDisposition($store = null) { - return $this->scopeConfig->getValue(self::XML_PATH_CONTENT_DISPOSITION, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); + return $this->scopeConfig->getValue( + self::XML_PATH_CONTENT_DISPOSITION, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } } diff --git a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/AbstractItems.php b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/AbstractItems.php index f8646f2fe1748..1caf555cb1855 100644 --- a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/AbstractItems.php +++ b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/AbstractItems.php @@ -105,6 +105,9 @@ public function getLinksTitle() if ($this->_purchasedLinks->getLinkSectionTitle()) { return $this->_purchasedLinks->getLinkSectionTitle(); } - return $this->_scopeConfig->getValue(\Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + return $this->_scopeConfig->getValue( + \Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } } diff --git a/app/code/Magento/DownloadableImportExport/Test/Unit/Model/Import/Product/Type/DownloadableTest.php b/app/code/Magento/DownloadableImportExport/Test/Unit/Model/Import/Product/Type/DownloadableTest.php index fd4f6c76cbf57..5b662e56f2014 100644 --- a/app/code/Magento/DownloadableImportExport/Test/Unit/Model/Import/Product/Type/DownloadableTest.php +++ b/app/code/Magento/DownloadableImportExport/Test/Unit/Model/Import/Product/Type/DownloadableTest.php @@ -601,8 +601,8 @@ public function isRowValidData() 'downloadable_samples' => 'group_title=Group Title Samples, title=Title 1, file=media/file.mp4' . ',sortorder=1|group_title=Group Title, title=Title 2, url=media/file2.mp4,sortorder=0', 'downloadable_links' => 'group_title=Group Title Links, title=Title 1, price=10,' - . ' downloads=unlimited, file=media/file.mp4,sortorder=1|group_title=Group Title, title=Title 2,' - . ' price=10, downloads=unlimited, url=media/file2.mp4,sortorder=0', + . ' downloads=unlimited, file=media/file.mp4,sortorder=1|group_title=Group Title,' + . ' title=Title 2, price=10, downloads=unlimited, url=media/file2.mp4,sortorder=0', ], 1, true diff --git a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractMain.php b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractMain.php index e692dfcc6c1e0..17a1287e38aaa 100644 --- a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractMain.php +++ b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractMain.php @@ -110,7 +110,6 @@ protected function _prepareForm() /** @var \Magento\Framework\Data\Form $form */ $form = $this->_formFactory->create( - ['data' => ['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post']] ); diff --git a/app/code/Magento/Eav/Model/Attribute.php b/app/code/Magento/Eav/Model/Attribute.php index 518a0c8078608..96f8e58ba9481 100644 --- a/app/code/Magento/Eav/Model/Attribute.php +++ b/app/code/Magento/Eav/Model/Attribute.php @@ -7,12 +7,13 @@ /** * EAV attribute resource model (Using Forms) * - * @method \Magento\Eav\Model\Attribute\Data\AbstractData|null getDataModel() Get data model linked to attribute or null. + * @method AbstractData|null getDataModel() Get data model linked to attribute or null. * * @author Magento Core Team */ namespace Magento\Eav\Model; +use Magento\Eav\Model\Attribute\Data\AbstractData; use Magento\Store\Model\Website; class Attribute extends \Magento\Eav\Model\Entity\Attribute diff --git a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php index bd0ee3bd81fe9..1b9f3e6f2abf2 100644 --- a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php +++ b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php @@ -1879,6 +1879,7 @@ protected function getAttributeLoader() * Perform actions after entity load * * @param \Magento\Framework\DataObject $object + * @return void */ public function afterLoad(\Magento\Framework\DataObject $object) { @@ -1889,6 +1890,7 @@ public function afterLoad(\Magento\Framework\DataObject $object) * Perform actions before entity save * * @param \Magento\Framework\DataObject $object + * @return void */ public function beforeSave(\Magento\Framework\DataObject $object) { @@ -1899,6 +1901,7 @@ public function beforeSave(\Magento\Framework\DataObject $object) * Perform actions after entity save * * @param \Magento\Framework\DataObject $object + * @return void */ public function afterSave(\Magento\Framework\DataObject $object) { @@ -1909,6 +1912,7 @@ public function afterSave(\Magento\Framework\DataObject $object) * Perform actions before entity delete * * @param \Magento\Framework\DataObject $object + * @return void */ public function beforeDelete(\Magento\Framework\DataObject $object) { @@ -1919,6 +1923,7 @@ public function beforeDelete(\Magento\Framework\DataObject $object) * Perform actions after entity delete * * @param \Magento\Framework\DataObject $object + * @return void */ public function afterDelete(\Magento\Framework\DataObject $object) { diff --git a/app/code/Magento/Eav/Test/Unit/Model/EavCustomAttributeTypeLocatorTest.php b/app/code/Magento/Eav/Test/Unit/Model/EavCustomAttributeTypeLocatorTest.php index 58b8ce9c5573b..f3267bb82ed17 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/EavCustomAttributeTypeLocatorTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/EavCustomAttributeTypeLocatorTest.php @@ -7,6 +7,7 @@ namespace Magento\Eav\Test\Unit\Model; use Magento\Eav\Api\AttributeRepositoryInterface; +use Magento\Eav\Model\Attribute\Data\Image; use Magento\Eav\Model\EavCustomAttributeTypeLocator; use Magento\Eav\Model\EavCustomAttributeTypeLocator\ComplexType as ComplexTypeLocator; use Magento\Eav\Model\EavCustomAttributeTypeLocator\SimpleType as SimpleTypeLocator; @@ -186,8 +187,7 @@ public function getTypeDataProvider() 'stringUtility' => $stringUtility, 'serviceEntityTypeMapData' => [$serviceInterface => 'image'], 'serviceBackendModelDataInterfaceMapData' => [ - $serviceInterface => [\Magento\Eav\Model\Attribute\Data\Image::class => $mediaAttributeDataInterface - ] + $serviceInterface => [Image::class => $mediaAttributeDataInterface] ], 'expected' => $mediaAttributeDataInterface ] diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Source/BooleanTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Source/BooleanTest.php index f029e7fa6864b..32888b618c735 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Source/BooleanTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Source/BooleanTest.php @@ -104,11 +104,13 @@ public function addValueSortToCollectionDataProvider() 'expectedJoinCondition' => [ 0 => [ 'requisites' => ['code_t1' => "table"], - 'condition' => "e.entity_id=code_t1.entity_id AND code_t1.attribute_id='123' AND code_t1.store_id='0'", + 'condition' + => "e.entity_id=code_t1.entity_id AND code_t1.attribute_id='123' AND code_t1.store_id='0'", ], 1 => [ 'requisites' => ['code_t2' => "table"], - 'condition' => "e.entity_id=code_t2.entity_id AND code_t2.attribute_id='123' AND code_t2.store_id='12'", + 'condition' + => "e.entity_id=code_t2.entity_id AND code_t2.attribute_id='123' AND code_t2.store_id='12'", ], ], 'expectedOrder' => 'IF(code_t2.value_id > 0, code_t2.value, code_t1.value) ASC', @@ -119,11 +121,13 @@ public function addValueSortToCollectionDataProvider() 'expectedJoinCondition' => [ 0 => [ 'requisites' => ['code_t1' => "table"], - 'condition' => "e.entity_id=code_t1.entity_id AND code_t1.attribute_id='123' AND code_t1.store_id='0'", + 'condition' + => "e.entity_id=code_t1.entity_id AND code_t1.attribute_id='123' AND code_t1.store_id='0'", ], 1 => [ 'requisites' => ['code_t2' => "table"], - 'condition' => "e.entity_id=code_t2.entity_id AND code_t2.attribute_id='123' AND code_t2.store_id='12'", + 'condition' + => "e.entity_id=code_t2.entity_id AND code_t2.attribute_id='123' AND code_t2.store_id='12'", ], ], 'expectedOrder' => 'IF(code_t2.value_id > 0, code_t2.value, code_t1.value) DESC', @@ -134,7 +138,8 @@ public function addValueSortToCollectionDataProvider() 'expectedJoinCondition' => [ 0 => [ 'requisites' => ['code_t' => "table"], - 'condition' => "e.entity_id=code_t.entity_id AND code_t.attribute_id='123' AND code_t.store_id='0'", + 'condition' + => "e.entity_id=code_t.entity_id AND code_t.attribute_id='123' AND code_t.store_id='0'", ], ], 'expectedOrder' => 'code_t.value DESC', @@ -145,7 +150,8 @@ public function addValueSortToCollectionDataProvider() 'expectedJoinCondition' => [ 0 => [ 'requisites' => ['code_t' => "table"], - 'condition' => "e.entity_id=code_t.entity_id AND code_t.attribute_id='123' AND code_t.store_id='0'", + 'condition' + => "e.entity_id=code_t.entity_id AND code_t.attribute_id='123' AND code_t.store_id='0'", ], ], 'expectedOrder' => 'code_t.value ASC', diff --git a/app/code/Magento/Email/Test/Unit/Model/BackendTemplateTest.php b/app/code/Magento/Email/Test/Unit/Model/BackendTemplateTest.php index 352c1e0e63997..a0bf3e3950c3b 100644 --- a/app/code/Magento/Email/Test/Unit/Model/BackendTemplateTest.php +++ b/app/code/Magento/Email/Test/Unit/Model/BackendTemplateTest.php @@ -63,7 +63,8 @@ protected function setUp() '', false ); - $this->resourceModelMock->expects($this->any())->method('getSystemConfigByPathsAndTemplateId')->willReturn(['test_config' => 2015]); + $this->resourceModelMock->expects($this->any())->method('getSystemConfigByPathsAndTemplateId') + ->willReturn(['test_config' => 2015]); /** @var ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject $objectManagerMock*/ $objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class); $objectManagerMock->expects($this->any()) diff --git a/app/code/Magento/Email/Test/Unit/Model/Template/Config/XsdTest.php b/app/code/Magento/Email/Test/Unit/Model/Template/Config/XsdTest.php index 49372b1f96d49..3d3cf9b4e3eb4 100644 --- a/app/code/Magento/Email/Test/Unit/Model/Template/Config/XsdTest.php +++ b/app/code/Magento/Email/Test/Unit/Model/Template/Config/XsdTest.php @@ -31,7 +31,9 @@ public function mergedXmlDataProvider() { return [ 'valid' => [ - '