Skip to content

Commit bc79f6d

Browse files
committed
[PSR-2 Compliance] Fix magento#8612: Hundreds of PHPCS-based static tests violations in mainline
- apply automatic PHPCBF fixes to make PHPCS happy - Step 0. Install phpcs globally: composer global require squizlabs/php_codesniffer:2.8.0 - Step 1. Execute tool to fix PSR-2 violations in PHP files: ~/.composer/vendor/bin/phpcbf --standard=PSR2 --extensions=php --ignore=generated/*,vendor/*,var/* .
1 parent 74f3a5a commit bc79f6d

File tree

448 files changed

+504
-832
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

448 files changed

+504
-832
lines changed

app/code/Magento/AdminNotification/Model/System/Message/Baseurl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Magento\Store\Model\Store;
1010

1111
/**
12-
* @deprecated
12+
* @deprecated
1313
*/
1414
class Baseurl implements \Magento\Framework\Notification\MessageInterface
1515
{

app/code/Magento/AdminNotification/Setup/InstallSchema.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,5 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
120120
$installer->getConnection()->createTable($table);
121121

122122
$installer->endSetup();
123-
124123
}
125124
}

app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase
1313
/**
1414
* @var \Magento\Store\Model\WebSite|\PHPUnit_Framework_MockObject_MockObject
1515
*/
16-
protected $webSiteModel;
16+
protected $webSiteModel;
1717

1818
/**
1919
* @var \Magento\CatalogImportExport\Model\Import\Product\StoreResolver|\PHPUnit_Framework_MockObject_MockObject

app/code/Magento/Analytics/Controller/Adminhtml/Subscription/Postpone.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public function __construct(
5555
$this->notificationTime = $notificationTime;
5656
$this->logger = $logger;
5757
parent::__construct($context);
58-
5958
}
6059

6160
/**

app/code/Magento/Analytics/Model/ReportWriter.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ public function write(WriteInterface $directory, $path)
8484
if (!$headers) {
8585
$headers = array_keys($row);
8686
$stream->writeCsv($headers);
87-
8887
}
8988
$stream->writeCsv($row);
9089
}

app/code/Magento/Analytics/ReportXml/Config/Mapper.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public function execute($configData)
3131
$entityData = array_shift($queryData['source']);
3232
$queries[$queryData['name']] = $queryData;
3333
$queries[$queryData['name']]['source'] = $entityData;
34-
3534
}
3635
return $queries;
3736
}

app/code/Magento/Analytics/ReportXml/DB/ColumnsResolver.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ public function getColumns(SelectBuilder $selectBuilder, $entityConfig)
6161
if (isset($attributeData['group'])) {
6262
$group[$columnAlias] = $expression;
6363
}
64-
6564
}
6665
$selectBuilder->setGroup(array_merge($selectBuilder->getGroup(), $group));
6766
return $columns;

app/code/Magento/Analytics/ReportXml/Query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Query implements \JsonSerializable
2525
private $selectHydrator;
2626

2727
/**
28-
* @var string
28+
* @var string
2929
*/
3030
private $connectionName;
3131

app/code/Magento/Analytics/ReportXml/ReportProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,5 @@ public function getReport($name, SearchCriteria $criteria = null)
5252
$connection = $this->connectionFactory->getConnection($query->getConnectionName());
5353
$statement = $connection->query($query->getSelect());
5454
return new \IteratorIterator($statement);
55-
5655
}
5756
}

app/code/Magento/Analytics/Test/Unit/Model/Config/Backend/Enabled/SubscriptionHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ protected function setUp()
9898
/**
9999
* @param int|null $value null means that $value was not changed
100100
* @param bool $isTokenExist
101-
*
101+
*
102102
* @dataProvider processDataProvider
103103
*/
104104
public function testProcess($value, $isTokenExist)

app/code/Magento/Authorizenet/Model/Directpost.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -281,15 +281,14 @@ protected function processCapture($result, $payment)
281281
switch ($result->getXResponseCode()) {
282282
case self::RESPONSE_CODE_APPROVED:
283283
case self::RESPONSE_CODE_HELD:
284-
if (
285-
in_array(
286-
$result->getXResponseReasonCode(),
287-
[
284+
if (in_array(
285+
$result->getXResponseReasonCode(),
286+
[
288287
self::RESPONSE_REASON_CODE_APPROVED,
289288
self::RESPONSE_REASON_CODE_PENDING_REVIEW,
290289
self::RESPONSE_REASON_CODE_PENDING_REVIEW_AUTHORIZED
291290
]
292-
)
291+
)
293292
) {
294293
if (!$payment->getParentTransactionId()
295294
|| $result->getXTransId() != $payment->getParentTransactionId()
@@ -534,8 +533,7 @@ public function validateResponse()
534533
{
535534
$response = $this->getResponse();
536535
//md5 check
537-
if (
538-
!$this->getConfigData('trans_md5')
536+
if (!$this->getConfigData('trans_md5')
539537
|| !$this->getConfigData('login')
540538
|| !$response->isValidHash($this->getConfigData('trans_md5'), $this->getConfigData('login'))
541539
) {
@@ -802,8 +800,7 @@ protected function declineOrder(\Magento\Sales\Model\Order $order, $message = ''
802800
{
803801
try {
804802
$response = $this->getResponse();
805-
if (
806-
$voidPayment && $response->getXTransId() && strtoupper($response->getXType())
803+
if ($voidPayment && $response->getXTransId() && strtoupper($response->getXType())
807804
== self::REQUEST_TYPE_AUTH_ONLY
808805
) {
809806
$order->getPayment()->setTransactionId(null)->setParentTransactionId($response->getXTransId())->void();

app/code/Magento/Backend/Model/Config/SessionLifetime/BackendModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function beforeSave()
2626
throw new LocalizedException(
2727
__('Admin session lifetime must be less than or equal to 31536000 seconds (one year)')
2828
);
29-
} else if ($value < self::MIN_LIFETIME) {
29+
} elseif ($value < self::MIN_LIFETIME) {
3030
throw new LocalizedException(
3131
__('Admin session lifetime must be greater than or equal to 60 seconds')
3232
);

app/code/Magento/Backend/Model/Locale/Manager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function switchBackendInterfaceLocale($localeCode)
7070
}
7171

7272
/**
73-
* Get general interface locale
73+
* Get general interface locale
7474
*
7575
* @return string
7676
*/

app/code/Magento/Backend/Model/Menu/Item/Validator.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ public function validate($data)
8282
}
8383

8484
foreach ($data as $param => $value) {
85-
if (
86-
$data[$param] !== null
85+
if ($data[$param] !== null
8786
&& isset(
8887
$this->_validators[$param]
8988
) && !$this->_validators[$param]->isValid(

app/code/Magento/Backend/Model/View/Layout/ConditionInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* </argument>
2020
* </arguments>
2121
* </type>
22-
*
22+
*
2323
* Registered condition can be used by ui component declaration in layout
2424
*
2525
* <uiComponent name="form" condition="condition::identifier" />

app/code/Magento/Backend/Model/View/Layout/ConditionPool.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
/**
1212
* Class ConditionPool
13-
*
13+
*
1414
* Registry for \Magento\Backend\Model\View\Layout\ConditionInterface
1515
* @see usage details in \Magento\Backend\Model\View\Layout\ConditionInterface description
1616
*

app/code/Magento/Backend/Model/View/Layout/FilterInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* </argument>
2424
* </arguments>
2525
* </type>
26-
*
26+
*
2727
*/
2828
interface FilterInterface
2929
{

app/code/Magento/Backend/Test/Unit/App/Action/Plugin/AuthenticationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function testProcessNotLoggedInUser($isIFrameParam, $isAjaxParam, $isForw
120120
if ($isIFrameParam) {
121121
$getParamCalls = 1;
122122
$actionName = 'deniedIframe';
123-
} else if ($isAjaxParam) {
123+
} elseif ($isAjaxParam) {
124124
$getParamCalls = 2;
125125
$actionName = 'deniedJson';
126126
} else {

app/code/Magento/Backend/Test/Unit/Block/Page/System/Config/Robots/ResetTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
/**
1313
* Class ResetTest
14-
* @deprecated
14+
* @deprecated
1515
* @package Magento\Backend\Test\Unit\Block\Page\System\Config\Robots
1616
*/
1717
class ResetTest extends \PHPUnit_Framework_TestCase

app/code/Magento/Braintree/Block/Adminhtml/Form/Field/Countries.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected function _toHtml()
4747

4848
/**
4949
* Sets name for input element
50-
*
50+
*
5151
* @param string $value
5252
* @return $this
5353
*/

app/code/Magento/Braintree/Block/Adminhtml/Form/Field/CountryCreditCard.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CountryCreditCard extends AbstractFieldArray
2525

2626
/**
2727
* Returns renderer for country element
28-
*
28+
*
2929
* @return Countries
3030
*/
3131
protected function getCountryRenderer()
@@ -42,7 +42,7 @@ protected function getCountryRenderer()
4242

4343
/**
4444
* Returns renderer for country element
45-
*
45+
*
4646
* @return CcTypes
4747
*/
4848
protected function getCcTypesRenderer()

app/code/Magento/Braintree/Controller/Payment/GetNonce.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ public function execute()
6565
$customerId = $this->session->getCustomerId();
6666
$result = $this->command->execute(['public_hash' => $publicHash, 'customer_id' => $customerId])->get();
6767
$response->setData(['paymentMethodNonce' => $result['paymentMethodNonce']]);
68-
6968
} catch (\Exception $e) {
7069
$this->logger->critical($e);
7170
return $this->processBadRequest($response);

app/code/Magento/Braintree/Model/Adminhtml/Source/PaymentAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class PaymentAction implements ArrayInterface
1515
{
1616
/**
1717
* Possible actions on order place
18-
*
18+
*
1919
* @return array
2020
*/
2121
public function toOptionArray()

app/code/Magento/Braintree/Model/Paypal/Helper/ShippingMethodUpdater.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,8 @@ public function execute($shippingMethod, Quote $quote)
5353
}
5454

5555
if (!$quote->getIsVirtual()) {
56-
5756
$shippingAddress = $quote->getShippingAddress();
5857
if ($shippingMethod !== $shippingAddress->getShippingMethod()) {
59-
6058
$this->disabledQuoteAddressValidation($quote);
6159

6260
$shippingAddress->setShippingMethod($shippingMethod);

app/code/Magento/Braintree/Model/Report/ConditionAppliers/MultipleValue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function apply($field, $condition, $value)
2424
{
2525
$result = false;
2626

27-
switch($condition) {
27+
switch ($condition) {
2828
case ApplierInterface::IN:
2929
$field->in($value);
3030
$result = true;

app/code/Magento/Braintree/Model/Report/ConditionAppliers/Range.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function apply($field, $condition, $value)
2424
{
2525
$result = false;
2626

27-
switch($condition) {
27+
switch ($condition) {
2828
case ApplierInterface::QTEQ:
2929
$field->greaterThanOrEqualTo($value);
3030
$result = true;

app/code/Magento/Braintree/Model/Report/ConditionAppliers/Text.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function apply($field, $condition, $value)
2525
$result = false;
2626

2727
$value = trim($value, "% \r\n\t");
28-
switch($condition) {
28+
switch ($condition) {
2929
case ApplierInterface::EQ:
3030
$field->is($value);
3131
$result = true;

app/code/Magento/Braintree/Model/Report/Row/TransactionMap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function getCustomAttributes()
119119
$output = [];
120120
foreach ($this->getMappedValues() as $key => $value) {
121121
$attribute = $this->attributeValueFactory->create();
122-
if(in_array($key, $shouldBeLocalized)) {
122+
if (in_array($key, $shouldBeLocalized)) {
123123
$value = __($value);
124124
}
125125
$output[] = $attribute->setAttributeCode($key)->setValue($value);

app/code/Magento/Braintree/Test/Unit/Gateway/Request/PaymentDataBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
/**
1717
* Class PaymentDataBuilderTest
18-
*
18+
*
1919
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2020
*/
2121
class PaymentDataBuilderTest extends \PHPUnit_Framework_TestCase

app/code/Magento/Braintree/Test/Unit/Model/Report/TransactionsCollectionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public function testGetItemsWithNullLimit()
187187

188188
/**
189189
* Add fields to filter
190-
*
190+
*
191191
* @dataProvider addToFilterDataProvider
192192
*/
193193
public function testAddToFilter($field, $condition, $filterMapperCall, $expectedCondition)
@@ -211,7 +211,7 @@ public function testAddToFilter($field, $condition, $filterMapperCall, $expected
211211

212212
/**
213213
* addToFilter DataProvider
214-
*
214+
*
215215
* @return array
216216
*/
217217
public function addToFilterDataProvider()

app/code/Magento/Braintree/Test/Unit/Ui/Component/Report/Filters/Type/DateRangeTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,12 @@ public function testPrepare($name, $filterData, $expectedCondition)
181181

182182
/**
183183
* Gets Filter mock
184-
*
184+
*
185185
* @param string $name
186186
* @param string $expectedType
187187
* @param string $expectedDate
188188
* @param int $i
189-
*
189+
*
190190
* @return Filter|\PHPUnit_Framework_MockObject_MockObject
191191
*/
192192
private function getFilterMock($name, $expectedType, $expectedDate, &$i)

app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Extend.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ public function isDisabledField()
115115
&& $this->getAttribute()->getAttributeCode() === 'price'
116116
)
117117
|| $this->getElement()->getReadonly();
118-
119118
}
120119

121120
/**

app/code/Magento/Bundle/Model/OptionRepository.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,7 @@ private function compareLinks(
276276
}
277277
foreach ($firstArray as $obj) {
278278
foreach ($secondArray as $objToCompare) {
279-
if (
280-
$obj->getId() != $objToCompare->getId()
279+
if ($obj->getId() != $objToCompare->getId()
281280
&& $obj instanceof \Magento\Bundle\Api\Data\LinkInterface
282281
&& $objToCompare instanceof \Magento\Bundle\Api\Data\LinkInterface
283282
) {

app/code/Magento/Bundle/Setup/UpgradeSchema.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con
2323
$setup->startSetup();
2424
$connection = $setup->getConnection();
2525
if (version_compare($context->getVersion(), '2.0.1', '<')) {
26-
2726
$fields = [
2827
['table' => 'catalog_product_index_price_bundle_opt_idx', 'column' => 'alt_group_price'],
2928
['table' => 'catalog_product_index_price_bundle_opt_tmp', 'column' => 'alt_group_price'],

app/code/Magento/CacheInvalidate/Observer/InvalidateVarnishObserver.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ public function execute(\Magento\Framework\Event\Observer $observer)
6565
if (!empty($tags)) {
6666
$this->purgeCache->sendPurgeRequest(implode('|', array_unique($tags)));
6767
}
68-
6968
}
7069
}
7170

app/code/Magento/Captcha/Model/DefaultModel.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ public function getBlockName()
117117
*/
118118
public function isRequired($login = null)
119119
{
120-
if (
121-
$this->isUserAuth()
120+
if ($this->isUserAuth()
122121
&& !$this->isShownToLoggedInUser()
123122
|| !$this->isEnabled()
124123
|| !in_array(
@@ -425,8 +424,7 @@ private function isShowAlways()
425424
return true;
426425
}
427426

428-
if (
429-
(string)$this->captchaData->getConfig('mode') == \Magento\Captcha\Helper\Data::MODE_AFTER_FAIL
427+
if ((string)$this->captchaData->getConfig('mode') == \Magento\Captcha\Helper\Data::MODE_AFTER_FAIL
430428
&& $this->getAllowedAttemptsForSameLogin() == 0
431429
) {
432430
return true;

app/code/Magento/Captcha/Observer/CheckGuestCheckoutObserver.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
6969
if ($checkoutMethod == \Magento\Checkout\Model\Type\Onepage::METHOD_GUEST) {
7070
if ($captchaModel->isRequired()) {
7171
$controller = $observer->getControllerAction();
72-
if (
73-
!$captchaModel->isCorrect($this->captchaStringResolver->resolve($controller->getRequest(), $formId))
72+
if (!$captchaModel->isCorrect($this->captchaStringResolver->resolve($controller->getRequest(), $formId))
7473
) {
7574
$this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
7675
$result = ['error' => 1, 'message' => __('Incorrect CAPTCHA')];

0 commit comments

Comments
 (0)