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 automatic PHP-CS-FIXER fixes to make PHPCS happy
- Step 0. Install php-cs-fixer globally: composer global require friendsofphp/php-cs-fixer:2.1.0
- Step 1. Remove outdated php-cs-fixer config: rm .php_cs
- Step 2. Execute tool: ~/.composer/vendor/bin/php-cs-fixer fix . --rules=no_extra_consecutive_blank_lines,method_separation -v
- Step 3. Reset changed fixture file to not break related unit test: git checkout HEAD -- lib/internal/Magento/Framework/Code/Test/Unit/_files/app/code/Magento/SomeModule/Model/SevenInterface.php
- Step 4. Restore outdated php-cs-fixer config: git checkout HEAD -- .php_cs
  • Loading branch information
orlangur committed Feb 26, 2017
1 parent 74fbb73 commit 74f3a5a
Show file tree
Hide file tree
Showing 436 changed files with 799 additions and 931 deletions.
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 @@ -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
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 @@ -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 @@ -5,7 +5,6 @@
*/
namespace Magento\Braintree\Controller\Adminhtml\Payment;


/**
* Class GetNonce
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class DateRangeTest extends \PHPUnit_Framework_TestCase
*/
private $filterModifierMock;


/**
* @var DataProviderInterface|\PHPUnit_Framework_MockObject_MockObject
*/
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Bundle/Model/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public function setId($id)
return $this->setData(self::KEY_ID, $id);
}


/**
* {@inheritdoc}
*/
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/Bundle/Model/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,5 +294,6 @@ public function setExtensionAttributes(\Magento\Bundle\Api\Data\OptionExtensionI
{
return $this->_setExtensionAttributes($extensionAttributes);
}

//@codeCoverageIgnoreEnd
}
2 changes: 2 additions & 0 deletions app/code/Magento/Bundle/Model/Source/Option/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public function toOptionArray()
}

//@codeCoverageIgnoreStart

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -136,5 +137,6 @@ public function setExtensionAttributes(\Magento\Bundle\Api\Data\OptionTypeExtens
{
return $this->_setExtensionAttributes($extensionAttributes);
}

//@codeCoverageIgnoreEnd
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected function setUp()
->will($this->returnValue($this->layout));

$objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$this->block = $objectManagerHelper->getObject(
$this->block = $objectManagerHelper->getObject(
\Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option::class,
['registry' => $registry, 'context' => $context]
);
Expand All @@ -74,7 +74,7 @@ public function testSetOption()
$otherOption = $this->getMock(\Magento\Bundle\Model\Option::class, [], [], '', false);
$otherOption->expects($this->any())->method('getId')->will($this->returnValue(16));

$selection = $this->getMock(
$selection = $this->getMock(
\Magento\Catalog\Model\Product::class,
['getSelectionId', '__wakeup'],
[],
Expand Down
27 changes: 13 additions & 14 deletions app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected function setUp()
->setMethods(['appendSelections'])
->disableOriginalConstructor()
->getMock();
$this->selectionCollection = $this->getMockBuilder(
$this->selectionCollection = $this->getMockBuilder(
\Magento\Bundle\Model\ResourceModel\Selection\Collection::class)
->disableOriginalConstructor()
->getMock();
Expand All @@ -150,13 +150,13 @@ protected function setUp()
->setMethods(['create'])
->disableOriginalConstructor()
->getMock();
$this->bundleSelectionMock = $this->getMock(
$this->bundleSelectionMock = $this->getMock(
\Magento\Bundle\Model\SelectionFactory::class, ['create'], [], '', false
);
$this->bundleFactoryMock = $this->getMock(
$this->bundleFactoryMock = $this->getMock(
\Magento\Bundle\Model\ResourceModel\BundleFactory::class, ['create'], [], '', false
);
$this->optionCollectionFactoryMock = $this->getMock(
$this->optionCollectionFactoryMock = $this->getMock(
\Magento\Bundle\Model\ResourceModel\Option\CollectionFactory::class, ['create'], [], '', false
);
$this->storeManagerMock = $this->getMock(\Magento\Store\Model\StoreManagerInterface::class, [], [], '', false);
Expand All @@ -173,7 +173,7 @@ protected function setUp()
$this->dataObjectHelperMock = $this->getMockBuilder(\Magento\Framework\Api\DataObjectHelper::class)
->disableOriginalConstructor()
->getMock();
$this->model = $helper->getObject(
$this->model = $helper->getObject(

LinkManagement::class,
[
Expand Down Expand Up @@ -322,7 +322,7 @@ public function testAddChildNonExistingOption()
->method('getId')
->will($this->returnValue(null));

$optionsCollectionMock = $this->getMock(
$optionsCollectionMock = $this->getMock(
\Magento\Bundle\Model\ResourceModel\Option\Collection::class, [], [], '', false
);
$optionsCollectionMock->expects($this->once())
Expand Down Expand Up @@ -377,7 +377,7 @@ public function testAddChildLinkedProductIsComposite()
->getMock();
$option->expects($this->once())->method('getId')->will($this->returnValue(1));

$optionsCollectionMock = $this->getMock(
$optionsCollectionMock = $this->getMock(
\Magento\Bundle\Model\ResourceModel\Option\Collection::class,
[],
[],
Expand Down Expand Up @@ -439,7 +439,7 @@ public function testAddChildProductAlreadyExistsInOption()
->getMock();
$option->expects($this->once())->method('getId')->will($this->returnValue(1));

$optionsCollectionMock = $this->getMock(
$optionsCollectionMock = $this->getMock(
\Magento\Bundle\Model\ResourceModel\Option\Collection::class,
[],
[],
Expand Down Expand Up @@ -488,7 +488,6 @@ public function testAddChildCouldNotSave()
->with($this->linkField)
->willReturn($this->linkField);


$linkedProductMock = $this->getMock(\Magento\Catalog\Model\Product::class, [], [], '', false);
$linkedProductMock->expects($this->any())->method('getId')->will($this->returnValue(13));
$linkedProductMock->expects($this->once())->method('isComposite')->will($this->returnValue(false));
Expand All @@ -507,7 +506,7 @@ public function testAddChildCouldNotSave()
->getMock();
$option->expects($this->once())->method('getId')->will($this->returnValue(1));

$optionsCollectionMock = $this->getMock(
$optionsCollectionMock = $this->getMock(
\Magento\Bundle\Model\ResourceModel\Option\Collection::class, [], [], '', false
);
$optionsCollectionMock->expects($this->once())
Expand Down Expand Up @@ -578,7 +577,7 @@ public function testAddChild()
->getMock();
$option->expects($this->once())->method('getId')->will($this->returnValue(1));

$optionsCollectionMock = $this->getMock(
$optionsCollectionMock = $this->getMock(
\Magento\Bundle\Model\ResourceModel\Option\Collection::class, [], [], '', false
);
$optionsCollectionMock->expects($this->once())
Expand Down Expand Up @@ -663,7 +662,7 @@ public function testSaveChild()
$this->storeManagerMock->expects($this->any())->method('getStore')->will($this->returnValue($store));
$store->expects($this->any())->method('getId')->will($this->returnValue(0));

$selection = $this->getMock(
$selection = $this->getMock(
\Magento\Bundle\Model\Selection::class,
[
'save',
Expand Down Expand Up @@ -737,7 +736,7 @@ public function testSaveChildFailedToSave()
$this->storeManagerMock->expects($this->any())->method('getStore')->will($this->returnValue($store));
$store->expects($this->any())->method('getId')->will($this->returnValue(0));

$selection = $this->getMock(
$selection = $this->getMock(
\Magento\Bundle\Model\Selection::class,
[
'save',
Expand Down Expand Up @@ -831,7 +830,7 @@ public function testSaveChildWithInvalidId()
->with($linkedProductSku)
->will($this->returnValue($linkedProductMock));

$selection = $this->getMock(
$selection = $this->getMock(
\Magento\Bundle\Model\Selection::class,
[
'getId',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1816,7 +1816,6 @@ public function testIsVirtual()
* @param int $getSelectionsIdsIndex
* @return \PHPUnit_Framework_MockObject_MockObject
*/

protected function getSelectionsByIdsMock($selectionIds, $productMock, $getSelectionsIndex, $getSelectionsIdsIndex)
{
$usedSelectionsMock = $this->getMockBuilder(\Magento\Bundle\Model\ResourceModel\Selection\Collection::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,29 @@ class DiscountCalculatorTest extends \PHPUnit_Framework_TestCase
*/
protected function setUp()
{
$this->productMock = $this->getMock(
$this->productMock = $this->getMock(
\Magento\Catalog\Model\Product::class,
[],
[],
'',
false
);
$this->priceInfoMock = $this->getMock(
$this->priceInfoMock = $this->getMock(
\Magento\Framework\Pricing\PriceInfo\Base::class,
['getPrice', 'getPrices'],
[],
'',
false
);
$this->finalPriceMock = $this->getMock(
$this->finalPriceMock = $this->getMock(
\Magento\Catalog\Pricing\Price\FinalPrice::class,
[],
[],
'',
false
);
$this->priceMock = $this->getMockForAbstractClass(
\Magento\Bundle\Pricing\Price\DiscountProviderInterface::class
$this->priceMock = $this->getMockForAbstractClass(
\Magento\Bundle\Pricing\Price\DiscountProviderInterface::class
);
$this->calculator = new \Magento\Bundle\Pricing\Price\DiscountCalculator();
}
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/CacheInvalidate/Model/SocketFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

class SocketFactory
{

/**
* @return \Zend\Http\Client\Adapter\Socket
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

class SocketFactoryTest extends \PHPUnit_Framework_TestCase
{

public function testCreate()
{
$factory = new \Magento\CacheInvalidate\Model\SocketFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public function __construct(
$this->resLogFactory = $resLogFactory;
}


/**
* Reset Attempts For Backend
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public function getProductOptions(
$requiredOnly = false
);


/**
* Get custom option for a specific product
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Alerts extends \Magento\Backend\Block\Widget\Tab
*/
protected function _prepareLayout()
{
$accordion = $this->getLayout()->createBlock(
$accordion = $this->getLayout()->createBlock(
\Magento\Backend\Block\Widget\Accordion::class)->setId('productAlerts');
/* @var $accordion \Magento\Backend\Block\Widget\Accordion */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* See COPYING.txt for license details.
*/


/**
* Sign up for an alert when the product price changes grid
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* See COPYING.txt for license details.
*/


/**
* Sign up for an alert when the product price changes grid
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function getAfterElementHtml()
$selectorOptions = $this->_jsonEncoder->encode($this->_getSelectorOptions());
$newCategoryCaption = __('New Category');

$button = $this->_layout->createBlock(
$button = $this->_layout->createBlock(
\Magento\Backend\Block\Widget\Button::class
)->setData(
[
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/Catalog/Block/Product/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public function __construct(
$data
);
}

// @codingStandardsIgnoreEnd

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
namespace Magento\Catalog\Block\Product\View\Options\Type;


/**
* Product options text type block
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected function _validateProducts()
$productIds = $this->attributeHelper->getProductIds();
if (!is_array($productIds)) {
$error = __('Please select products for attributes update.');
} elseif (!$this->_objectManager->create(
} elseif (!$this->_objectManager->create(
\Magento\Catalog\Model\Product::class)->isProductsHasSku($productIds)) {
$error = __('Please make sure to define SKU values for all processed products.');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/
namespace Magento\Catalog\Controller\Adminhtml\Product;


class AlertsPriceGrid extends AbstractProductGrid
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function __construct(
$this->resultRawFactory = $resultRawFactory;
$this->layoutFactory = $layoutFactory;
}

/**
* Get specified tab grid
*
Expand Down
Loading

0 comments on commit 74f3a5a

Please sign in to comment.