Skip to content

Commit df01d64

Browse files
committed
AC-2220: Removed obsolete layout check
1 parent 81ebc1d commit df01d64

File tree

2 files changed

+1
-33
lines changed

2 files changed

+1
-33
lines changed

Magento2/Sniffs/Legacy/LayoutSniff.php

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
class LayoutSniff implements Sniff
1919
{
2020
private const ERROR_CODE_XML = 'WrongXML';
21-
private const ERROR_CODE_NOT_ALLOWED = 'NotAllowed';
2221
private const ERROR_CODE_OBSOLETE_BLOCK = 'ObsoleteBlock';
2322
private const ERROR_CODE_OBSOLETE_CLASS = 'ObsoleteClass';
2423
private const ERROR_CODE_OBSOLETE_TOHTML_ATTRIBUTE = 'ObsoleteToHtmlAttribute';
@@ -230,7 +229,6 @@ public function process(File $phpcsFile, $stackPtr)
230229
}
231230

232231
$this->testObsoleteReferences($layout, $phpcsFile);
233-
$this->testHeadBlocks($layout, $phpcsFile);
234232
$this->testOutputAttribute($layout, $phpcsFile);
235233
$this->testHelperAttribute($layout, $phpcsFile);
236234
$this->testListText($layout, $phpcsFile);
@@ -276,35 +274,6 @@ private function getFormattedXML(File $phpcsFile)
276274
return $doc->saveXML();
277275
}
278276

279-
/**
280-
* Check that CSS, Link and Script blocks are inside a head block
281-
*
282-
* @param SimpleXMLElement $layout
283-
* @param File $phpcsFile
284-
*/
285-
private function testHeadBlocks(SimpleXMLElement $layout, File $phpcsFile): void
286-
{
287-
$selectorHeadBlock = '(name()="block" or name()="referenceBlock") and ' .
288-
'(@name="head" or @name="convert_root_head" or @name="vde_head")';
289-
$elements = $layout->xpath(
290-
'//block[@class="Magento\Theme\Block\Html\Head\Css" ' .
291-
'or @class="Magento\Theme\Block\Html\Head\Link" ' .
292-
'or @class="Magento\Theme\Block\Html\Head\Script"]' .
293-
'/parent::*[not(' .
294-
$selectorHeadBlock .
295-
')]'
296-
);
297-
if (!empty($elements)) {
298-
$phpcsFile->addError(
299-
'Blocks \Magento\Theme\Block\Html\Head\{Css,Link,Script} ' .
300-
'are allowed within the "head" block only. ' .
301-
'Verify integrity of the nodes nesting.',
302-
dom_import_simplexml($elements[0])->getLineNo(),
303-
self::ERROR_CODE_NOT_ALLOWED
304-
);
305-
};
306-
}
307-
308277
/**
309278
* Check that the output attribute has the right value
310279
*
@@ -378,7 +347,7 @@ private function testListText(SimpleXMLElement $layout, File $phpcsFile): void
378347
dom_import_simplexml($elements[0])->getLineNo()-1,
379348
self::ERROR_CODE_OBSOLETE_CLASS
380349
);
381-
};
350+
}
382351
}
383352

384353
/**

Magento2/Tests/Legacy/LayoutUnitTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public function getErrorList($testFile = '')
1818
return [
1919
13 => 1,
2020
22 => 1,
21-
23 => 1,
2221
145 => 1,
2322
148 => 1,
2423
];

0 commit comments

Comments
 (0)