Skip to content

Commit 5732d54

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

File tree

1 file changed

+1
-31
lines changed

1 file changed

+1
-31
lines changed

Magento2/Sniffs/Legacy/LayoutSniff.php

Lines changed: 1 addition & 31 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';
@@ -276,35 +275,6 @@ private function getFormattedXML(File $phpcsFile)
276275
return $doc->saveXML();
277276
}
278277

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-
308278
/**
309279
* Check that the output attribute has the right value
310280
*
@@ -378,7 +348,7 @@ private function testListText(SimpleXMLElement $layout, File $phpcsFile): void
378348
dom_import_simplexml($elements[0])->getLineNo()-1,
379349
self::ERROR_CODE_OBSOLETE_CLASS
380350
);
381-
};
351+
}
382352
}
383353

384354
/**

0 commit comments

Comments
 (0)