|
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'; |
@@ -230,7 +229,6 @@ public function process(File $phpcsFile, $stackPtr) |
230 | 229 | } |
231 | 230 |
|
232 | 231 | $this->testObsoleteReferences($layout, $phpcsFile); |
233 | | - $this->testHeadBlocks($layout, $phpcsFile); |
234 | 232 | $this->testOutputAttribute($layout, $phpcsFile); |
235 | 233 | $this->testHelperAttribute($layout, $phpcsFile); |
236 | 234 | $this->testListText($layout, $phpcsFile); |
@@ -276,35 +274,6 @@ private function getFormattedXML(File $phpcsFile) |
276 | 274 | return $doc->saveXML(); |
277 | 275 | } |
278 | 276 |
|
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 | 277 | /** |
309 | 278 | * Check that the output attribute has the right value |
310 | 279 | * |
@@ -378,7 +347,7 @@ private function testListText(SimpleXMLElement $layout, File $phpcsFile): void |
378 | 347 | dom_import_simplexml($elements[0])->getLineNo()-1, |
379 | 348 | self::ERROR_CODE_OBSOLETE_CLASS |
380 | 349 | ); |
381 | | - }; |
| 350 | + } |
382 | 351 | } |
383 | 352 |
|
384 | 353 | /** |
|
0 commit comments