Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PSR-2 Compliance] Fix #8612: Hundreds of PHPCS-based static tests violations in mainline #8685

Merged
merged 6 commits into from
Mar 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ cache:
directories: $HOME/.composer/cache
matrix:
exclude:
- php: 7.0
- php: 5.6.29
env: TEST_SUITE=static
before_install: ./dev/travis/before_install.sh
install: composer install --no-interaction --prefer-dist
before_script: ./dev/travis/before_script.sh
script:
- cd dev/tests/$TEST_SUITE
- test $TEST_SUITE = "static" && TEST_FILTER='--filter "Magento\\Test\\Php\\LiveCodeTest"' || true
- phpunit $TEST_FILTER
- phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Magento\Store\Model\Store;

/**
* @deprecated
* @deprecated
*/
class Baseurl implements \Magento\Framework\Notification\MessageInterface
{
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/AdminNotification/Setup/InstallSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,5 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
$installer->getConnection()->createTable($table);

$installer->endSetup();

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase
/**
* @var \Magento\Store\Model\WebSite|\PHPUnit_Framework_MockObject_MockObject
*/
protected $webSiteModel;
protected $webSiteModel;

/**
* @var \Magento\CatalogImportExport\Model\Import\Product\StoreResolver|\PHPUnit_Framework_MockObject_MockObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public function __construct(
$this->notificationTime = $notificationTime;
$this->logger = $logger;
parent::__construct($context);

}

/**
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Analytics/Model/FileRecorder.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ public function recordNewFile(EncodedContext $encodedContext)
$this->removeOldFile($fileInfo, $directory);

return true;

}

/**
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Analytics/Model/ReportWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public function write(WriteInterface $directory, $path)
if (!$headers) {
$headers = array_keys($row);
$stream->writeCsv($headers);

}
$stream->writeCsv($row);
}
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Analytics/ReportXml/Config/Mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public function execute($configData)
$entityData = array_shift($queryData['source']);
$queries[$queryData['name']] = $queryData;
$queries[$queryData['name']]['source'] = $entityData;

}
return $queries;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public function getColumns(SelectBuilder $selectBuilder, $entityConfig)
if (isset($attributeData['group'])) {
$group[$columnAlias] = $expression;
}

}
$selectBuilder->setGroup(array_merge($selectBuilder->getGroup(), $group));
return $columns;
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Analytics/ReportXml/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Query implements \JsonSerializable
private $selectHydrator;

/**
* @var string
* @var string
*/
private $connectionName;

Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Analytics/ReportXml/ReportProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,5 @@ public function getReport($name, SearchCriteria $criteria = null)
$connection = $this->connectionFactory->getConnection($query->getConnectionName());
$statement = $connection->query($query->getSelect());
return $this->iteratorFactory->create($statement, $this->getIteratorName($query));

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public function testAfterSave()
Value::class,
$this->collectionTime->afterSave()
);

}

/**
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
?>

<section class="dashboard-advanced-reports" data-index="dashboard-advanced-reports">
Expand Down
15 changes: 6 additions & 9 deletions app/code/Magento/Authorizenet/Model/Directpost.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,14 @@ protected function processCapture($result, $payment)
switch ($result->getXResponseCode()) {
case self::RESPONSE_CODE_APPROVED:
case self::RESPONSE_CODE_HELD:
if (
in_array(
$result->getXResponseReasonCode(),
[
if (in_array(
$result->getXResponseReasonCode(),
[
self::RESPONSE_REASON_CODE_APPROVED,
self::RESPONSE_REASON_CODE_PENDING_REVIEW,
self::RESPONSE_REASON_CODE_PENDING_REVIEW_AUTHORIZED
]
)
)
) {
if (!$payment->getParentTransactionId()
|| $result->getXTransId() != $payment->getParentTransactionId()
Expand Down Expand Up @@ -534,8 +533,7 @@ public function validateResponse()
{
$response = $this->getResponse();
//md5 check
if (
!$this->getConfigData('trans_md5')
if (!$this->getConfigData('trans_md5')
|| !$this->getConfigData('login')
|| !$response->isValidHash($this->getConfigData('trans_md5'), $this->getConfigData('login'))
) {
Expand Down Expand Up @@ -802,8 +800,7 @@ protected function declineOrder(\Magento\Sales\Model\Order $order, $message = ''
{
try {
$response = $this->getResponse();
if (
$voidPayment && $response->getXTransId() && strtoupper($response->getXType())
if ($voidPayment && $response->getXTransId() && strtoupper($response->getXType())
== self::REQUEST_TYPE_AUTH_ONLY
) {
$order->getPayment()->setTransactionId(null)->setParentTransactionId($response->getXTransId())->void();
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Backend/Block/Dashboard/Sales.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
namespace Magento\Backend\Block\Dashboard;


/**
* Adminhtml dashboard sales statistics bar
*
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Backend/Block/Dashboard/Totals.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
*/
namespace Magento\Backend\Block\Dashboard;


class Totals extends \Magento\Backend\Block\Dashboard\Bar
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected function _prepareForm()
'required' => true
]
);
$renderer = $this->getLayout()->createBlock(
$renderer = $this->getLayout()->createBlock(
\Magento\Backend\Block\Store\Switcher\Form\Renderer\Fieldset\Element::class
);
$field->setRenderer($renderer);
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/
namespace Magento\Backend\Block\Widget\Grid\Column\Renderer;


class Country extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function beforeSave()
throw new LocalizedException(
__('Admin session lifetime must be less than or equal to 31536000 seconds (one year)')
);
} else if ($value < self::MIN_LIFETIME) {
} elseif ($value < self::MIN_LIFETIME) {
throw new LocalizedException(
__('Admin session lifetime must be greater than or equal to 60 seconds')
);
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Model/Locale/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function switchBackendInterfaceLocale($localeCode)
}

/**
* Get general interface locale
* Get general interface locale
*
* @return string
*/
Expand Down
3 changes: 1 addition & 2 deletions app/code/Magento/Backend/Model/Menu/Item/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ public function validate($data)
}

foreach ($data as $param => $value) {
if (
$data[$param] !== null
if ($data[$param] !== null
&& isset(
$this->_validators[$param]
) && !$this->_validators[$param]->isValid(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* </argument>
* </arguments>
* </type>
*
*
* Registered condition can be used by ui component declaration in layout
*
* <uiComponent name="form" condition="condition::identifier" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

/**
* Class ConditionPool
*
*
* Registry for \Magento\Backend\Model\View\Layout\ConditionInterface
* @see usage details in \Magento\Backend\Model\View\Layout\ConditionInterface description
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* </argument>
* </arguments>
* </type>
*
*
*/
interface FilterInterface
{
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
1 change: 1 addition & 0 deletions app/code/Magento/Backend/Service/V1/ModuleService.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ModuleService implements ModuleServiceInterface
* @var \Magento\Framework\Module\ModuleListInterface
*/
protected $moduleList;

/**
* @param \Magento\Framework\Module\ModuleListInterface $moduleList
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function testProcessNotLoggedInUser($isIFrameParam, $isAjaxParam, $isForw
if ($isIFrameParam) {
$getParamCalls = 1;
$actionName = 'deniedIframe';
} else if ($isAjaxParam) {
} elseif ($isAjaxParam) {
$getParamCalls = 2;
$actionName = 'deniedJson';
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

/**
* Class ResetTest
* @deprecated
* @deprecated
* @package Magento\Backend\Test\Unit\Block\Page\System\Config\Robots
*/
class ResetTest extends \PHPUnit_Framework_TestCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected function setUp()
->disableOriginalConstructor()
->getMock();
$objectHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$context = $objectHelper->getObject(
$context = $objectHelper->getObject(
\Magento\Backend\App\Action\Context::class,
[
'objectManager' => $this->objectManagerMock,
Expand All @@ -58,7 +58,7 @@ protected function setUp()
]
);

$this->controller = $objectHelper->getObject(
$this->controller = $objectHelper->getObject(
\Magento\Backend\Controller\Adminhtml\Cache\CleanStaticFiles::class,
['context' => $context,]
);
Expand Down
2 changes: 0 additions & 2 deletions app/code/Magento/Backup/Model/Config/Backend/Cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ class Cron extends \Magento\Framework\App\Config\Value
/** @var \Magento\Framework\App\Config\ValueFactory */
protected $_configValueFactory;


/** @var string */
protected $_runModelPath = '';


/**
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected function _toHtml()

/**
* Sets name for input element
*
*
* @param string $value
* @return $this
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CountryCreditCard extends AbstractFieldArray

/**
* Returns renderer for country element
*
*
* @return Countries
*/
protected function getCountryRenderer()
Expand All @@ -42,7 +42,7 @@ protected function getCountryRenderer()

/**
* Returns renderer for country element
*
*
* @return CcTypes
*/
protected function getCcTypesRenderer()
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
namespace Magento\Braintree\Controller\Adminhtml\Payment;


/**
* Class GetNonce
*/
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Braintree/Controller/Payment/GetNonce.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public function execute()
$customerId = $this->session->getCustomerId();
$result = $this->command->execute(['public_hash' => $publicHash, 'customer_id' => $customerId])->get();
$response->setData(['paymentMethodNonce' => $result['paymentMethodNonce']]);

} catch (\Exception $e) {
$this->logger->critical($e);
return $this->processBadRequest($response);
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class PaymentAction implements ArrayInterface
{
/**
* Possible actions on order place
*
*
* @return array
*/
public function toOptionArray()
Expand Down
Loading