Skip to content

Commit

Permalink
[PSR-2 Compliance] Fix magento#8612: Hundreds of PHPCS-based static t…
Browse files Browse the repository at this point in the history
…ests 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)
  • Loading branch information
orlangur committed Feb 26, 2017
1 parent 0dcab3b commit 74fbb73
Show file tree
Hide file tree
Showing 61 changed files with 190 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
7 changes: 7 additions & 0 deletions app/code/Magento/Backend/Model/View/Layout/Reader/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions app/code/Magento/Braintree/Gateway/Config/PayPal/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions app/code/Magento/Braintree/Model/Ui/PayPal/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ protected function setUp()
* @param array|null $expectedCondition
* @dataProvider getPrepareDataProvider
* @return void
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function testPrepare($name, $filterData, $expectedCondition)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ $payerEmail = $block->escapeHtml($block->getPayerEmail());
"modalClass": "my-credit-cards-popup",
"toggleEvent": "click",
"title": "<?php echo $block->escapeHtml(__('Delete')); ?>",
"content": "Are you sure you want to delete this PayPal account: <?php /* @noEscape */ echo $payerEmail; ?>?"
"content": "Are you sure you want to delete this PayPal account:
<?php /* @noEscape */ echo $payerEmail; ?>?"
}
}'>
<span><?php echo $block->escapeHtml(__('Delete')); ?></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Improved implements AlgorithmInterface
* @var Render
*/
private $render;

/**
* @var IntervalFactory
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class StoreResolver
* @var array
*/
protected $websiteCodeToStoreIds = [];

/**
* All stores code-ID pairs.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Resolver implements ResolverInterface
* @var AttributeCollection
*/
private $attributeCollection;

/**
* @var FieldFactory
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
?>
<div class="cart-empty">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/Customer/Model/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Context
* Customer group cache context
*/
const CONTEXT_GROUP = 'customer_group';

/**
* Customer authorization cache context
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
?>
<script type="text/x-magento-template" id="group-product-template">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ class AVSResponse implements ValidatorInterface
*/
const IAVS = 'iavs';

/** Values of the response */
/**#@+ Values of the response */
const RESPONSE_YES = 'y';

const RESPONSE_NO = 'n';

const RESPONSE_NOT_SUPPORTED = 'x';
/** */
/**#@-*/

/** Values of the validation settings payments */
/**#@+ Values of the validation settings payments */
const CONFIG_ON = 1;

const CONFIG_OFF = 0;
/** */
/**#@-*/

/**
* @var array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ class CVV2Match implements ValidatorInterface
*/
const ERROR_MESSAGE = 'Card security code does not match.';

/** Values of the response */
/**#@+ Values of the response */
const RESPONSE_YES = 'y';

const RESPONSE_NO = 'n';

const RESPONSE_NOT_SUPPORTED = 'x';
/** */
/**#@-*/

/** Validation settings payments */
/**#@+ Validation settings payments */
const CONFIG_ON = 1;

const CONFIG_OFF = 0;

const CONFIG_NAME = 'avs_security_code';
/** */
/**#@-*/

/**
* Validate data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/



// @codingStandardsIgnoreFile
/**
* @var \Magento\Paypal\Block\Payflow\Link\Info $block
* @see \Magento\Paypal\Block\Payflow\Link\Info
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/ProductVideo/Helper/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Media extends \Magento\Framework\App\Helper\AbstractHelper
* Configuration path for show related
*/
const XML_PATH_SHOW_RELATED = 'catalog/product_video/show_related';

/**
* Configuration path for video auto restart
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ class CollectTotalsObserver implements ObserverInterface
protected $groupManagement;

/**
* Initialize dependencies.
*
* @param \Magento\Customer\Helper\Address $customerAddressHelper
* @param \Magento\Customer\Model\Vat $customerVat
* @param VatValidator $vatValidator
* @param \Magento\Customer\Api\Data\CustomerInterfaceFactory $customerDataFactory
* @param \Magento\Customer\Api\GroupManagementInterface $groupManagement
* @param \Magento\Customer\Api\AddressRepositoryInterface $addressRepository
* @param \Magento\Customer\Model\Session $customerSession
*/
public function __construct(
\Magento\Customer\Helper\Address $customerAddressHelper,
Expand All @@ -78,6 +78,7 @@ public function __construct(
*
* @param \Magento\Framework\Event\Observer $observer
* @return void
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function execute(\Magento\Framework\Event\Observer $observer)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ require([
}

if (jQuery('#filter_form').valid()) {
setLocation('<?php /* @escapeNotVerified */ echo $block->getFilterUrl(); ?>filter/'+Base64.encode(Form.serializeElements(elements))+'/');
setLocation('<?php /* @escapeNotVerified */ echo $block->getFilterUrl();?>filter/'+
Base64.encode(Form.serializeElements(elements))+'/'
);
}
}
//]]>
Expand Down
Loading

0 comments on commit 74fbb73

Please sign in to comment.