Skip to content

Commit c87c521

Browse files
committed
[PSR-2 Compliance] The Great @codingStandardsIgnoreFile Massacre
- apply manual fixes to make PHPMD happy
1 parent 40ba673 commit c87c521

File tree

31 files changed

+66
-131
lines changed

31 files changed

+66
-131
lines changed

app/code/Magento/Catalog/Observer/Compare/BindCustomerLoginObserver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(
2828
* @param \Magento\Framework\Event\Observer $observer
2929
* @return $this
3030
*
31-
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
31+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3232
*/
3333
public function execute(\Magento\Framework\Event\Observer $observer)
3434
{

app/code/Magento/Catalog/Observer/Compare/BindCustomerLogoutObserver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(
2828
* @param \Magento\Framework\Event\Observer $observer
2929
* @return $this
3030
*
31-
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
31+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3232
*/
3333
public function execute(\Magento\Framework\Event\Observer $observer)
3434
{

app/code/Magento/Catalog/Test/Unit/Model/System/Config/Backend/Catalog/Url/Rewrite/SuffixTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\Catalog\Test\Unit\Model\System\Config\Backend\Catalog\Url\Rewrite;
77

8+
/**
9+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
10+
*/
811
class SuffixTest extends \PHPUnit_Framework_TestCase
912
{
1013
/**

app/code/Magento/CatalogRule/Model/ResourceModel/ReadHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function __construct(
4141
* @param array $arguments
4242
* @return array
4343
* @throws \Exception
44+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4445
*/
4546
public function execute($entityType, $entityData, $arguments = [])
4647
{

app/code/Magento/CatalogRule/Model/ResourceModel/SaveHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function __construct(
4141
* @param array $arguments
4242
* @return array
4343
* @throws \Exception
44+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4445
*/
4546
public function execute($entityType, $entityData, $arguments = [])
4647
{

app/code/Magento/Cms/Model/ResourceModel/Block/Relation/Store/SaveHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function __construct(
4242
* @param array $arguments
4343
* @return object
4444
* @throws \Exception
45+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4546
*/
4647
public function execute($entity, $arguments = [])
4748
{

app/code/Magento/Cms/Model/ResourceModel/Page/Relation/Store/SaveHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function __construct(
4242
* @param array $arguments
4343
* @return object
4444
* @throws \Exception
45+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4546
*/
4647
public function execute($entity, $arguments = [])
4748
{

app/code/Magento/ConfigurableProduct/Test/Unit/Helper/DataTest.php

Lines changed: 14 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
namespace Magento\ConfigurableProduct\Test\Unit\Helper;
88

9+
use Magento\Catalog\Model\Product;
10+
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
11+
use Magento\Framework\DataObject;
12+
913
class DataTest extends \PHPUnit_Framework_TestCase
1014
{
1115
/**
@@ -19,27 +23,21 @@ class DataTest extends \PHPUnit_Framework_TestCase
1923
protected $_imageHelperMock;
2024

2125
/**
22-
* @var \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject
26+
* @var Product|\PHPUnit_Framework_MockObject_MockObject
2327
*/
2428
protected $_productMock;
2529

2630
protected function setUp()
2731
{
2832
$this->_imageHelperMock = $this->getMock(\Magento\Catalog\Helper\Image::class, [], [], '', false);
29-
$this->_productMock = $this->getMock(\Magento\Catalog\Model\Product::class, [], [], '', false);
33+
$this->_productMock = $this->getMock(Product::class, [], [], '', false);
3034

3135
$this->_model = new \Magento\ConfigurableProduct\Helper\Data($this->_imageHelperMock);
3236
}
3337

3438
public function testGetAllowAttributes()
3539
{
36-
$typeInstanceMock = $this->getMock(
37-
\Magento\ConfigurableProduct\Model\Product\Type\Configurable::class,
38-
[],
39-
[],
40-
'',
41-
false
42-
);
40+
$typeInstanceMock = $this->getMock(Configurable::class, [], [], '', false);
4341
$typeInstanceMock->expects($this->once())
4442
->method('getConfigurableAttributes')
4543
->with($this->_productMock);
@@ -93,39 +91,14 @@ public function testGetOptions(array $expected, array $data)
9391
*/
9492
public function getOptionsDataProvider()
9593
{
96-
$currentProductMock = $this->getMock(
97-
\Magento\Catalog\Model\Product::class,
98-
['getTypeInstance', '__wakeup'],
99-
[],
100-
'',
101-
false
102-
);
103-
$provider = [];
104-
$provider[] = [
105-
[],
106-
[
107-
'allowed_products' => [],
108-
'current_product_mock' => $currentProductMock,
109-
],
110-
];
94+
$currentProductMock = $this->getMock(Product::class, ['getTypeInstance', '__wakeup'], [], '', false);
95+
$provider = [[[], ['allowed_products' => [], 'current_product_mock' => $currentProductMock]]];
11196

11297
$attributesCount = 3;
11398
$attributes = [];
11499
for ($i = 1; $i < $attributesCount; $i++) {
115-
$attribute = $this->getMock(
116-
\Magento\Framework\DataObject::class,
117-
['getProductAttribute'],
118-
[],
119-
'',
120-
false
121-
);
122-
$productAttribute = $this->getMock(
123-
\Magento\Framework\DataObject::class,
124-
['getId', 'getAttributeCode'],
125-
[],
126-
'',
127-
false
128-
);
100+
$attribute = $this->getMock(DataObject::class, ['getProductAttribute'], [], '', false);
101+
$productAttribute = $this->getMock(DataObject::class, ['getId', 'getAttributeCode'], [], '', false);
129102
$productAttribute->expects($this->any())
130103
->method('getId')
131104
->will($this->returnValue('attribute_id_' . $i));
@@ -137,13 +110,7 @@ public function getOptionsDataProvider()
137110
->will($this->returnValue($productAttribute));
138111
$attributes[] = $attribute;
139112
}
140-
$typeInstanceMock = $this->getMock(
141-
\Magento\ConfigurableProduct\Model\Product\Type\Configurable::class,
142-
[],
143-
[],
144-
'',
145-
false
146-
);
113+
$typeInstanceMock = $this->getMock(Configurable::class, [], [], '', false);
147114
$typeInstanceMock->expects($this->any())
148115
->method('getConfigurableAttributes')
149116
->will($this->returnValue($attributes));
@@ -153,7 +120,7 @@ public function getOptionsDataProvider()
153120
$allowedProducts = [];
154121
for ($i = 1; $i <= 2; $i++) {
155122
$productMock = $this->getMock(
156-
\Magento\Catalog\Model\Product::class,
123+
Product::class,
157124
['getData', 'getImage', 'getId', '__wakeup', 'getMediaGalleryImages'],
158125
[],
159126
'',
@@ -261,7 +228,7 @@ private function getImagesCollection()
261228
->getMock();
262229

263230
$items = [
264-
new \Magento\Framework\DataObject([
231+
new DataObject([
265232
'file' => 'test_file'
266233
]),
267234
];

app/code/Magento/Customer/Controller/Account/CreatePost.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
/**
3232
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
33+
* @SuppressWarnings(PHPMD.TooManyFields)
3334
*/
3435
class CreatePost extends \Magento\Customer\Controller\AbstractAccount
3536
{

app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Group/SaveTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
/**
1515
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
16+
* @SuppressWarnings(PHPMD.TooManyFields)
1617
*/
1718
class SaveTest extends \PHPUnit_Framework_TestCase
1819
{

app/code/Magento/Directory/Model/Country.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* @method \Magento\Directory\Model\Country setCountryId(string $value)
1616
*
1717
* @api
18+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1819
*/
1920
class Country extends \Magento\Framework\Model\AbstractModel
2021
{

app/code/Magento/Paypal/Test/Unit/Model/Payment/Method/Billing/AbstractAgreementStub.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public function getCode()
2222
/**
2323
* @param object $quote
2424
* @return bool
25+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
2526
*/
2627
protected function _isAvailable($quote)
2728
{

app/code/Magento/ProductAlert/Test/Unit/Model/ObserverTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
99

10+
/**
11+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
12+
* @SuppressWarnings(PHPMD.TooManyFields)
13+
*/
1014
class ObserverTest extends \PHPUnit_Framework_TestCase
1115
{
1216
/**

app/code/Magento/Review/Block/Adminhtml/Add.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ protected function _construct()
8585
params.form_key = FORM_KEY;
8686
}
8787
new Ajax.Updater("rating_detail", "' .
88-
$this->getUrl(
89-
'review/product/ratingItems'
90-
) .
88+
$this->getUrl('review/product/ratingItems') .
9189
'", {
9290
parameters:params,
9391
evalScripts: true,
@@ -101,9 +99,7 @@ protected function _construct()
10199
$("product_id").value = response.id;
102100
103101
$("product_name").innerHTML = \'<a href="' .
104-
$this->getUrl(
105-
'catalog/product/edit'
106-
) .
102+
$this->getUrl('catalog/product/edit') .
107103
'id/\' + response.id + \'" target="_blank">\' + response.name + \'</a>\';
108104
} else if ( response.message ) {
109105
alert(response.message);

app/code/Magento/Sales/Model/Order/Validation/RefundInvoice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Magento\Sales\Model\ValidatorResultMerger;
1919

2020
/**
21-
* Class RefundInvoice
21+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2222
*/
2323
class RefundInvoice implements RefundInvoiceInterface
2424
{

app/code/Magento/Sales/Model/Order/Validation/ShipOrder.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function __construct(
6161
* @param array $packages
6262
* @param \Magento\Sales\Api\Data\ShipmentCreationArgumentsInterface|null $arguments
6363
* @return \Magento\Sales\Model\ValidatorResultInterface
64+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
6465
*/
6566
public function validate(
6667
$order,
@@ -73,18 +74,10 @@ public function validate(
7374
array $packages = [],
7475
\Magento\Sales\Api\Data\ShipmentCreationArgumentsInterface $arguments = null
7576
) {
76-
$orderValidationResult = $this->orderValidator->validate(
77-
$order,
78-
[
79-
CanShip::class
80-
]
81-
);
77+
$orderValidationResult = $this->orderValidator->validate($order, [CanShip::class]);
8278
$shipmentValidationResult = $this->shipmentValidator->validate(
8379
$shipment,
84-
[
85-
QuantityValidator::class,
86-
TrackValidator::class
87-
]
80+
[QuantityValidator::class, TrackValidator::class]
8881
);
8982

9083
return $this->validatorResultMerger->merge($orderValidationResult, $shipmentValidationResult);

app/code/Magento/Sales/Setup/UpgradeData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Magento\Framework\DB\FieldDataConverterFactory;
1111

1212
/**
13-
* Data upgrade script
13+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1414
*/
1515
class UpgradeData implements \Magento\Framework\Setup\UpgradeDataInterface
1616
{

app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Invoice/CaptureTest.php

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\Sales\Test\Unit\Controller\Adminhtml\Order\Invoice;
77

8+
use Magento\Backend\Model\View\Result\ForwardFactory;
9+
use Magento\Backend\Model\View\Result\RedirectFactory;
10+
use Magento\Framework\App\ActionFlag;
811
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
912
use Magento\Sales\Api\InvoiceRepositoryInterface;
1013

@@ -51,12 +54,12 @@ class CaptureTest extends \PHPUnit_Framework_TestCase
5154
protected $helperMock;
5255

5356
/**
54-
* @var \Magento\Backend\Model\View\Result\RedirectFactory|\PHPUnit_Framework_MockObject_MockObject
57+
* @var RedirectFactory|\PHPUnit_Framework_MockObject_MockObject
5558
*/
5659
protected $resultRedirectFactoryMock;
5760

5861
/**
59-
* @var \Magento\Backend\Model\View\Result\ForwardFactory|\PHPUnit_Framework_MockObject_MockObject
62+
* @var ForwardFactory|\PHPUnit_Framework_MockObject_MockObject
6063
*/
6164
protected $resultForwardFactoryMock;
6265

@@ -103,27 +106,15 @@ protected function setUp()
103106
->setMethods([])
104107
->getMock();
105108

106-
$this->actionFlagMock = $this->getMockBuilder(\Magento\Framework\App\ActionFlag::class)
107-
->disableOriginalConstructor()
108-
->setMethods([])
109-
->getMock();
109+
$this->actionFlagMock = $this->getMock(ActionFlag::class, [], [], '', false);
110110

111111
$this->helperMock = $this->getMockBuilder(\Magento\Backend\Helper\Data::class)
112112
->disableOriginalConstructor()
113113
->setMethods([])
114114
->getMock();
115115

116-
$this->resultRedirectFactoryMock = $this->getMockBuilder(
117-
\Magento\Backend\Model\View\Result\RedirectFactory::class
118-
)->disableOriginalConstructor()
119-
->setMethods(['create'])
120-
->getMock();
121-
122-
$this->resultForwardFactoryMock = $this->getMockBuilder(
123-
\Magento\Backend\Model\View\Result\ForwardFactory::class
124-
)->disableOriginalConstructor()
125-
->setMethods(['create'])
126-
->getMock();
116+
$this->resultRedirectFactoryMock = $this->getMock(RedirectFactory::class, ['create'], [], '', false);
117+
$this->resultForwardFactoryMock = $this->getMock(ForwardFactory::class, ['create'], [], '', false);
127118

128119
$contextMock = $this->getMockBuilder(\Magento\Backend\App\Action\Context::class)
129120
->disableOriginalConstructor()

app/code/Magento/SalesRule/Model/ResourceModel/ReadHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function __construct(
4141
* @param array $arguments
4242
* @return array
4343
* @throws \Exception
44+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4445
*/
4546
public function execute($entityType, $entityData, $arguments = [])
4647
{

app/code/Magento/SalesRule/Model/ResourceModel/SaveHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function __construct(
4141
* @param array $arguments
4242
* @return array
4343
* @throws \Exception
44+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4445
*/
4546
public function execute($entityType, $entityData, $arguments = [])
4647
{

app/code/Magento/Store/Model/Config/Reader/Source/Dynamic/DefaultScope.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function __construct(
4242
*
4343
* @param string|null $scopeCode
4444
* @return array
45+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4546
*/
4647
public function get($scopeCode = null)
4748
{

app/code/Magento/Tax/Block/Adminhtml/Items/Price/Renderer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class Renderer extends \Magento\Backend\Block\Template
4343
* @param TaxHelper $taxHelper
4444
* @param ItemPriceRenderer $itemPriceRenderer
4545
* @param array $data
46+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4647
*/
4748
public function __construct(
4849
\Magento\Backend\Block\Template\Context $context,

app/code/Magento/Tax/Model/Sales/Total/Quote/Shipping.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public function collect(
5858
* @param \Magento\Quote\Model\Quote $quote
5959
* @param Address\Total $total
6060
* @return array|null
61+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
6162
*/
6263
public function fetch(\Magento\Quote\Model\Quote $quote, \Magento\Quote\Model\Quote\Address\Total $total)
6364
{

app/code/Magento/Tax/Model/Sales/Total/Quote/Subtotal.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function collect(
6161
* @param Address\Total $total
6262
* @return null
6363
* @codeCoverageIgnore
64+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
6465
*/
6566
public function fetch(\Magento\Quote\Model\Quote $quote, \Magento\Quote\Model\Quote\Address\Total $total)
6667
{

0 commit comments

Comments
 (0)