Skip to content

Commit 51db083

Browse files
committed
Fixed coding standard violations in the Framework\Controller, Framework\CSS, Framework\Phrase and Framework\Pricing namespace, so that it will be checked bij PHP CS and no longer be ignored while doing CI checks. Made the following changes:
- Removed @codingStandardsIgnoreFile at the head of the files - Fixed indentation - Fixed line length - Changed is_null function call to a === null compare
1 parent d5f2939 commit 51db083

File tree

5 files changed

+64
-39
lines changed

5 files changed

+64
-39
lines changed

lib/internal/Magento/Framework/Controller/Test/Unit/Result/RedirectFactoryTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* See COPYING.txt for license details.
77
*/
88

9-
// @codingStandardsIgnoreFile
10-
119
namespace Magento\Framework\Controller\Test\Unit\Result;
1210

1311
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;

lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/Instruction/ImportTest.php

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\Framework\Css\Test\Unit\PreProcessor\Instruction;
108

119
use Magento\Framework\Css\PreProcessor\FileGenerator\RelatedGenerator;
@@ -40,13 +38,26 @@ protected function setUp()
4038
{
4139

4240
$this->notationResolver = $this->getMock(
43-
\Magento\Framework\View\Asset\NotationResolver\Module::class, [], [], '', false
41+
\Magento\Framework\View\Asset\NotationResolver\Module::class,
42+
[],
43+
[],
44+
'',
45+
false
4446
);
4547
$contextMock = $this->getMockForAbstractClass(
46-
\Magento\Framework\View\Asset\ContextInterface::class, [], '', false
48+
\Magento\Framework\View\Asset\ContextInterface::class,
49+
[],
50+
'',
51+
false
4752
);
4853
$contextMock->expects($this->any())->method('getPath')->willReturn('');
49-
$this->asset = $this->getMock(\Magento\Framework\View\Asset\File::class, [], [], '', false);
54+
$this->asset = $this->getMock(
55+
\Magento\Framework\View\Asset\File::class,
56+
[],
57+
[],
58+
'',
59+
false
60+
);
5061
$this->asset->expects($this->any())->method('getContentType')->will($this->returnValue('css'));
5162
$this->asset->expects($this->any())->method('getContext')->willReturn($contextMock);
5263

@@ -67,7 +78,12 @@ protected function setUp()
6778
*/
6879
public function testProcess($originalContent, $foundPath, $resolvedPath, $expectedContent)
6980
{
70-
$chain = new \Magento\Framework\View\Asset\PreProcessor\Chain($this->asset, $originalContent, 'less', 'path');
81+
$chain = new \Magento\Framework\View\Asset\PreProcessor\Chain(
82+
$this->asset,
83+
$originalContent,
84+
'less',
85+
'path'
86+
);
7187
$invoke = $this->once();
7288
if (preg_match('/^(http:|https:|\/+)/', $foundPath)) {
7389
$invoke = $this->never();
@@ -160,7 +176,12 @@ public function testProcessNoImport()
160176
$originalContent = 'color: #000000;';
161177
$expectedContent = 'color: #000000;';
162178

163-
$chain = new \Magento\Framework\View\Asset\PreProcessor\Chain($this->asset, $originalContent, 'css', 'path');
179+
$chain = new \Magento\Framework\View\Asset\PreProcessor\Chain(
180+
$this->asset,
181+
$originalContent,
182+
'css',
183+
'path'
184+
);
164185
$this->notationResolver->expects($this->never())
165186
->method('convertModuleNotationToPath');
166187
$this->object->process($chain);
@@ -186,7 +207,12 @@ public function testGetRelatedFiles()
186207
'path'
187208
);
188209
$this->object->process($chain);
189-
$chain = new \Magento\Framework\View\Asset\PreProcessor\Chain($this->asset, 'color: #000000;', 'css', 'path');
210+
$chain = new \Magento\Framework\View\Asset\PreProcessor\Chain(
211+
$this->asset,
212+
'color: #000000;',
213+
'css',
214+
'path'
215+
);
190216
$this->object->process($chain);
191217

192218
$expected = [['Magento_Module::something.css', $this->asset]];

lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/Instruction/MagentoImportTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\Framework\Css\Test\Unit\PreProcessor\Instruction;
108

119
use Magento\Framework\Css\PreProcessor\Instruction\MagentoImport;
@@ -181,7 +179,10 @@ public function testProcessNoImport()
181179
public function testProcessException()
182180
{
183181
$chain = new \Magento\Framework\View\Asset\PreProcessor\Chain(
184-
$this->asset, '//@magento_import "some/file.css";', 'css', 'path'
182+
$this->asset,
183+
'//@magento_import "some/file.css";',
184+
'css',
185+
'path'
185186
);
186187
$exception = new \LogicException('Error happened');
187188
$this->assetRepo->expects($this->once())

lib/internal/Magento/Framework/Phrase/Test/Unit/Renderer/CompositeTest.php

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\Framework\Phrase\Test\Unit\Renderer;
108

119
use \Magento\Framework\Phrase\Renderer\Composite;
@@ -53,27 +51,27 @@ public function testRender()
5351
$this->rendererOne->expects(
5452
$this->once()
5553
)->method(
56-
'render'
57-
)->with(
58-
[$text],
59-
$arguments
60-
)->will(
61-
$this->returnValue($resultAfterFirst)
62-
);
54+
'render'
55+
)->with(
56+
[$text],
57+
$arguments
58+
)->will(
59+
$this->returnValue($resultAfterFirst)
60+
);
6361

6462
$this->rendererTwo->expects(
6563
$this->once()
6664
)->method(
67-
'render'
68-
)->with(
69-
[
70-
$text,
71-
$resultAfterFirst,
72-
],
73-
$arguments
74-
)->will(
75-
$this->returnValue($resultAfterSecond)
76-
);
65+
'render'
66+
)->with(
67+
[
68+
$text,
69+
$resultAfterFirst,
70+
],
71+
$arguments
72+
)->will(
73+
$this->returnValue($resultAfterSecond)
74+
);
7775

7876
$this->assertEquals($resultAfterSecond, $this->object->render([$text], $arguments));
7977
}

lib/internal/Magento/Framework/Pricing/Render/RendererPool.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\Framework\Pricing\Render;
108

119
use Magento\Framework\Pricing\Amount\AmountInterface;
@@ -79,7 +77,9 @@ public function createPriceRender(
7977
$renderBlock = $this->getLayout()->createBlock($renderClassName, '', $arguments);
8078
if (!$renderBlock instanceof PriceBoxRenderInterface) {
8179
throw new \InvalidArgumentException(
82-
'Block "' . $renderClassName . '" must implement \Magento\Framework\Pricing\Render\PriceBoxRenderInterface'
80+
'Block "' .
81+
$renderClassName .
82+
'" must implement \Magento\Framework\Pricing\Render\PriceBoxRenderInterface'
8383
);
8484
}
8585
$renderBlock->setTemplate($this->getRenderBlockTemplate($type, $priceCode));
@@ -142,7 +142,9 @@ public function createAmountRender(
142142
$amountBlock = $this->getLayout()->createBlock($renderClassName, '', $arguments);
143143
if (!$amountBlock instanceof AmountRenderInterface) {
144144
throw new \InvalidArgumentException(
145-
'Block "' . $renderClassName . '" must implement \Magento\Framework\Pricing\Render\AmountRenderInterface'
145+
'Block "' .
146+
$renderClassName .
147+
'" must implement \Magento\Framework\Pricing\Render\AmountRenderInterface'
146148
);
147149
}
148150
$amountBlock->setTemplate($this->getAmountRenderBlockTemplate($type, $priceCode));
@@ -156,15 +158,15 @@ public function createAmountRender(
156158
*/
157159
public function getAdjustmentRenders(SaleableInterface $saleableItem = null, PriceInterface $price = null)
158160
{
159-
$itemType = is_null($saleableItem) ? 'default' : $saleableItem->getTypeId();
160-
$priceType = is_null($price) ? 'default' : $price->getPriceCode();
161+
$itemType = $saleableItem === null ? 'default' : $saleableItem->getTypeId();
162+
$priceType = $price === null ? 'default' : $price->getPriceCode();
161163

162164
$fallbackPattern = [
163165
"{$itemType}/adjustments/{$priceType}",
164166
"{$itemType}/adjustments/default",
165167
"default/adjustments/{$priceType}",
166168
"default/adjustments/default",
167-
];
169+
];
168170
$renders = $this->findDataByPattern($fallbackPattern);
169171
if ($renders) {
170172
foreach ($renders as $code => $configuration) {

0 commit comments

Comments
 (0)