From 74fbb738d62183ccf840b49afd037a6665cbdfa6 Mon Sep 17 00:00:00 2001 From: Vlad Veselov Date: Sun, 26 Feb 2017 22:58:18 +0200 Subject: [PATCH] [PSR-2 Compliance] Fix #8612: Hundreds of PHPCS-based static tests violations in mainline - apply manual fixes to make PHPCS and PHPMD happy - some phtml templates marked as ignored for now as PHPCS 1.5.3 version produces false-positives on them (PHPCS 2.8.0 treats them fine) --- .../Block/Widget/Grid/Column/Filter/Store.php | 1 + .../Model/View/Layout/Reader/Block.php | 7 ++ .../Customer/PayPal/VaultTokenRenderer.php | 5 ++ .../Gateway/Config/PayPal/Config.php | 6 ++ .../Model/Ui/PayPal/ConfigProvider.php | 7 ++ .../Report/Filters/Type/DateRangeTest.php | 1 + .../templates/paypal/vault_token.phtml | 3 +- .../Model/Layer/Filter/Dynamic/Improved.php | 1 + .../Model/Import/Product/StoreResolver.php | 1 + .../Model/Adapter/Mysql/Field/Resolver.php | 1 + .../Search/FilterMapper/FilterContext.php | 1 + .../frontend/templates/cart/noItems.phtml | 2 +- .../CustomerData/Plugin/SessionChecker.php | 1 + app/code/Magento/Customer/Model/Context.php | 1 + .../Model/Plugin/CustomerNotification.php | 3 +- .../templates/product/grouped/list.phtml | 1 + .../Response/Validator/AVSResponse.php | 8 +- .../Service/Response/Validator/CVV2Match.php | 8 +- .../view/frontend/templates/hss/info.phtml | 4 +- .../Magento/ProductVideo/Helper/Media.php | 1 + .../Quote/Address/CollectTotalsObserver.php | 5 +- .../templates/report/grid/container.phtml | 4 +- .../Sales/Api/Data/OrderAddressInterface.php | 75 ++++++++++++------- .../Sales/Model/ResourceModel/Attribute.php | 1 + .../Shipping/Model/Simplexml/Element.php | 4 +- .../Magento/Store/Model/Config/StoreView.php | 2 + app/code/Magento/Store/Model/PathConfig.php | 2 + .../templates/product/view/renderer.phtml | 1 + .../Config/SearchRobots/ResetButton.php | 1 + .../Controller/Adminhtml/Bookmark/Delete.php | 1 + .../Api/Data/PaymentTokenInterfaceFactory.php | 1 + .../Vault/Block/Customer/PaymentTokens.php | 2 +- .../Webapi/Model/Rest/Swagger/Generator.php | 1 + .../Webapi/Adapter/Rest/CurlClient.php | 1 + .../Test/TestStep/UpdateTermEntityStep.php | 1 + .../Vault/Test/Block/StoredPayments.php | 6 +- .../TestFramework/Annotation/DbIsolation.php | 1 + .../Magento/Tax/Model/TaxCalculationTest.php | 1 + dev/tests/unit/framework/bootstrap.php | 4 +- .../Framework/Cache/Backend/MongoDb.php | 13 +--- .../DB/Test/Unit/Adapter/Pdo/MysqlTest.php | 7 +- .../Framework/HTTP/PhpEnvironment/Request.php | 9 ++- .../Framework/Indexer/GridStructure.php | 1 + .../Framework/Indexer/IndexStructure.php | 2 + .../ScopeResolver/FlatScopeResolver.php | 1 + .../Framework/Indexer/Test/Unit/XsdTest.php | 1 + .../Magento/Framework/Locale/Resolver.php | 1 + .../Adapter/Mysql/Aggregation/Interval.php | 1 + .../Search/Adapter/Mysql/ConditionManager.php | 1 + .../Search/Adapter/Mysql/Field/Field.php | 2 + .../Adapter/Mysql/Query/MatchContainer.php | 1 + .../Adapter/Mysql/Query/QueryContainer.php | 1 + .../Magento/Framework/Simplexml/Element.php | 4 +- .../TestFramework/Unit/Module/Config.php | 2 +- .../View/Template/Html/MinifierInterface.php | 1 + pub/errors/default/503.phtml | 5 +- pub/errors/default/report.phtml | 1 + pub/errors/processor.php | 39 ++++++---- .../Unit/Controller/ExtensionGridTest.php | 6 +- .../Test/Unit/Controller/ModuleGridTest.php | 4 +- setup/view/magento/setup/license.phtml | 1 + 61 files changed, 190 insertions(+), 91 deletions(-) diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Store.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Store.php index f2663290dbeaa..d18a655ba88c2 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Store.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Store.php @@ -12,6 +12,7 @@ class Store extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFilter { const ALL_STORE_VIEWS = '0'; + /** * @var \Magento\Store\Model\System\Store */ diff --git a/app/code/Magento/Backend/Model/View/Layout/Reader/Block.php b/app/code/Magento/Backend/Model/View/Layout/Reader/Block.php index 150a0c7a82191..2abdb35f93bb0 100644 --- a/app/code/Magento/Backend/Model/View/Layout/Reader/Block.php +++ b/app/code/Magento/Backend/Model/View/Layout/Reader/Block.php @@ -13,6 +13,13 @@ */ class Block extends Layout\Reader\Block { + /** + * @param Layout\ScheduledStructure\Helper $helper + * @param Layout\Argument\Parser $argumentParser + * @param Layout\ReaderPool $readerPool + * @param InterpreterInterface $argumentInterpreter + * @param null $scopeType + */ public function __construct( Layout\ScheduledStructure\Helper $helper, Layout\Argument\Parser $argumentParser, diff --git a/app/code/Magento/Braintree/Block/Customer/PayPal/VaultTokenRenderer.php b/app/code/Magento/Braintree/Block/Customer/PayPal/VaultTokenRenderer.php index 33458b399e795..28629251f2fcc 100644 --- a/app/code/Magento/Braintree/Block/Customer/PayPal/VaultTokenRenderer.php +++ b/app/code/Magento/Braintree/Block/Customer/PayPal/VaultTokenRenderer.php @@ -21,6 +21,11 @@ class VaultTokenRenderer extends AbstractTokenRenderer */ private $config; + /** + * @param Template\Context $context + * @param Config $config + * @param array $data + */ public function __construct( Template\Context $context, Config $config, diff --git a/app/code/Magento/Braintree/Gateway/Config/PayPal/Config.php b/app/code/Magento/Braintree/Gateway/Config/PayPal/Config.php index 3f34afd0717db..ad6d8361b8b40 100644 --- a/app/code/Magento/Braintree/Gateway/Config/PayPal/Config.php +++ b/app/code/Magento/Braintree/Gateway/Config/PayPal/Config.php @@ -35,6 +35,12 @@ class Config extends \Magento\Payment\Gateway\Config\Config */ private $icon = []; + /** + * @param ScopeConfigInterface $scopeConfig + * @param CcConfig $ccConfig + * @param null $methodCode + * @param string $pathPattern + */ public function __construct( ScopeConfigInterface $scopeConfig, CcConfig $ccConfig, diff --git a/app/code/Magento/Braintree/Model/Ui/PayPal/ConfigProvider.php b/app/code/Magento/Braintree/Model/Ui/PayPal/ConfigProvider.php index 270e0ed6e83c0..061766d6c2ac5 100644 --- a/app/code/Magento/Braintree/Model/Ui/PayPal/ConfigProvider.php +++ b/app/code/Magento/Braintree/Model/Ui/PayPal/ConfigProvider.php @@ -28,12 +28,19 @@ class ConfigProvider implements ConfigProviderInterface */ private $resolver; + /** + * @param Config $config + * @param ResolverInterface $resolver + */ public function __construct(Config $config, ResolverInterface $resolver) { $this->config = $config; $this->resolver = $resolver; } + /** + * @return array + */ public function getConfig() { return [ diff --git a/app/code/Magento/Braintree/Test/Unit/Ui/Component/Report/Filters/Type/DateRangeTest.php b/app/code/Magento/Braintree/Test/Unit/Ui/Component/Report/Filters/Type/DateRangeTest.php index 479651b90de69..56045c8bfe4b7 100644 --- a/app/code/Magento/Braintree/Test/Unit/Ui/Component/Report/Filters/Type/DateRangeTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Ui/Component/Report/Filters/Type/DateRangeTest.php @@ -81,6 +81,7 @@ protected function setUp() * @param array|null $expectedCondition * @dataProvider getPrepareDataProvider * @return void + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function testPrepare($name, $filterData, $expectedCondition) { diff --git a/app/code/Magento/Braintree/view/frontend/templates/paypal/vault_token.phtml b/app/code/Magento/Braintree/view/frontend/templates/paypal/vault_token.phtml index 80844768e2212..85c127361f727 100644 --- a/app/code/Magento/Braintree/view/frontend/templates/paypal/vault_token.phtml +++ b/app/code/Magento/Braintree/view/frontend/templates/paypal/vault_token.phtml @@ -39,7 +39,8 @@ $payerEmail = $block->escapeHtml($block->getPayerEmail()); "modalClass": "my-credit-cards-popup", "toggleEvent": "click", "title": "escapeHtml(__('Delete')); ?>", - "content": "Are you sure you want to delete this PayPal account: ?" + "content": "Are you sure you want to delete this PayPal account: + ?" } }'> escapeHtml(__('Delete')); ?> diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/Improved.php b/app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/Improved.php index 4f700c14270bc..a5ed757635c01 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/Improved.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/Improved.php @@ -35,6 +35,7 @@ class Improved implements AlgorithmInterface * @var Render */ private $render; + /** * @var IntervalFactory */ diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/StoreResolver.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/StoreResolver.php index 108ab592dbc7c..a7c5699874819 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product/StoreResolver.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/StoreResolver.php @@ -27,6 +27,7 @@ class StoreResolver * @var array */ protected $websiteCodeToStoreIds = []; + /** * All stores code-ID pairs. * diff --git a/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Field/Resolver.php b/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Field/Resolver.php index 380a2966288f8..2293168ccc430 100644 --- a/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Field/Resolver.php +++ b/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Field/Resolver.php @@ -16,6 +16,7 @@ class Resolver implements ResolverInterface * @var AttributeCollection */ private $attributeCollection; + /** * @var FieldFactory */ diff --git a/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/FilterContext.php b/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/FilterContext.php index d8d3efc65e782..1ebc2e5141ff9 100644 --- a/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/FilterContext.php +++ b/app/code/Magento/CatalogSearch/Model/Search/FilterMapper/FilterContext.php @@ -14,6 +14,7 @@ /** * FilterContext represents a Context of the Strategy pattern * Its responsibility is to choose appropriate strategy to apply passed filter to the Select + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class FilterContext implements FilterStrategyInterface { diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/noItems.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/noItems.phtml index 26fb8a9bd71bd..e1b0b35cfcfb0 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/noItems.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/noItems.phtml @@ -3,7 +3,7 @@ * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - +// @codingStandardsIgnoreFile /** @var $block \Magento\Checkout\Block\Cart */ ?>
diff --git a/app/code/Magento/Customer/CustomerData/Plugin/SessionChecker.php b/app/code/Magento/Customer/CustomerData/Plugin/SessionChecker.php index 6ee04cea5f85b..ab93d432f13b6 100644 --- a/app/code/Magento/Customer/CustomerData/Plugin/SessionChecker.php +++ b/app/code/Magento/Customer/CustomerData/Plugin/SessionChecker.php @@ -37,6 +37,7 @@ public function __construct( * Delete frontend session cookie if customer session is expired * * @param SessionManager $sessionManager + * @return void */ public function beforeStart(SessionManager $sessionManager) { diff --git a/app/code/Magento/Customer/Model/Context.php b/app/code/Magento/Customer/Model/Context.php index 8634993e8866b..526a3bfa092fd 100644 --- a/app/code/Magento/Customer/Model/Context.php +++ b/app/code/Magento/Customer/Model/Context.php @@ -11,6 +11,7 @@ class Context * Customer group cache context */ const CONTEXT_GROUP = 'customer_group'; + /** * Customer authorization cache context */ diff --git a/app/code/Magento/Customer/Model/Plugin/CustomerNotification.php b/app/code/Magento/Customer/Model/Plugin/CustomerNotification.php index c064c07086db0..1e013b21cfe66 100644 --- a/app/code/Magento/Customer/Model/Plugin/CustomerNotification.php +++ b/app/code/Magento/Customer/Model/Plugin/CustomerNotification.php @@ -37,11 +37,10 @@ class CustomerNotification private $state; /** - * CustomerNotification constructor. - * * @param Session $session * @param NotificationStorage $notificationStorage * @param State $state + * @param CustomerRepositoryInterface $customerRepository */ public function __construct( Session $session, diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/templates/product/grouped/list.phtml b/app/code/Magento/GroupedProduct/view/adminhtml/templates/product/grouped/list.phtml index 3367b9a534455..6af487d0338d1 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/templates/product/grouped/list.phtml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/templates/product/grouped/list.phtml @@ -3,6 +3,7 @@ * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile /* @var $block \Magento\GroupedProduct\Block\Product\Grouped\AssociatedProducts\ListAssociatedProducts */ ?>