|
18 | 18 | class LayoutSniff implements Sniff
|
19 | 19 | {
|
20 | 20 | private const ERROR_CODE_XML = 'WrongXML';
|
21 |
| - private const ERROR_CODE_NOT_ALLOWED = 'NotAllowed'; |
22 | 21 | private const ERROR_CODE_OBSOLETE_BLOCK = 'ObsoleteBlock';
|
23 | 22 | private const ERROR_CODE_OBSOLETE_CLASS = 'ObsoleteClass';
|
24 | 23 | private const ERROR_CODE_OBSOLETE_TOHTML_ATTRIBUTE = 'ObsoleteToHtmlAttribute';
|
@@ -276,35 +275,6 @@ private function getFormattedXML(File $phpcsFile)
|
276 | 275 | return $doc->saveXML();
|
277 | 276 | }
|
278 | 277 |
|
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 |
| - |
308 | 278 | /**
|
309 | 279 | * Check that the output attribute has the right value
|
310 | 280 | *
|
@@ -378,7 +348,7 @@ private function testListText(SimpleXMLElement $layout, File $phpcsFile): void
|
378 | 348 | dom_import_simplexml($elements[0])->getLineNo()-1,
|
379 | 349 | self::ERROR_CODE_OBSOLETE_CLASS
|
380 | 350 | );
|
381 |
| - }; |
| 351 | + } |
382 | 352 | }
|
383 | 353 |
|
384 | 354 | /**
|
|
0 commit comments