11<?php
2+
23/**
34 * Copyright © Magento, Inc. All rights reserved.
45 * See COPYING.txt for license details.
56 */
6- declare (strict_types = 1 );
7+
8+ declare (strict_types=1 );
79
810namespace Magento2 \Sniffs \Legacy ;
911
@@ -248,11 +250,12 @@ private function testObsoleteReferences(SimpleXMLElement $layout, File $phpcsFil
248250 if (!isset ($ this ->obsoleteReferences [$ handleAttribute ])) {
249251 continue ;
250252 }
253+
251254 foreach ($ handle ->xpath ('//reference | //referenceContainer | //referenceBlock ' ) as $ reference ) {
252255 if (in_array ((string )$ reference ['name ' ], $ this ->obsoleteReferences [$ handleAttribute ]) !== false ) {
253256 $ phpcsFile ->addError (
254257 'The block being referenced is removed. ' ,
255- dom_import_simplexml ($ reference )->getLineNo ()- 1 ,
258+ dom_import_simplexml ($ reference )->getLineNo () - 1 ,
256259 self ::ERROR_CODE_OBSOLETE_BLOCK
257260 );
258261 }
@@ -264,6 +267,7 @@ private function testObsoleteReferences(SimpleXMLElement $layout, File $phpcsFil
264267 * Format the incoming XML to avoid tags split into several lines.
265268 *
266269 * @param File $phpcsFile
270+ *
267271 * @return false|string
268272 */
269273 private function getFormattedXML (File $ phpcsFile )
@@ -286,7 +290,7 @@ private function testOutputAttribute(SimpleXMLElement $layout, File $phpcsFile):
286290 if (!empty ($ elements )) {
287291 $ phpcsFile ->addError (
288292 'output="toHtml" is obsolete. Use output="1" ' ,
289- dom_import_simplexml ($ elements [0 ])->getLineNo ()- 1 ,
293+ dom_import_simplexml ($ elements [0 ])->getLineNo () - 1 ,
290294 self ::ERROR_CODE_OBSOLETE_TOHTML_ATTRIBUTE
291295 );
292296 };
@@ -297,6 +301,7 @@ private function testOutputAttribute(SimpleXMLElement $layout, File $phpcsFile):
297301 *
298302 * @param SimpleXMLElement $element
299303 * @param string $name
304+ *
300305 * @return string|null
301306 */
302307 private function getAttribute (SimpleXMLElement $ element , string $ name ): string
@@ -317,14 +322,15 @@ private function testHelperAttribute(SimpleXMLElement $layout, File $phpcsFile):
317322 if (strpos ($ this ->getAttribute ($ action , 'helper ' ), '/ ' ) !== false ) {
318323 $ phpcsFile ->addError (
319324 "'helper' attribute contains '/' " ,
320- dom_import_simplexml ($ action )->getLineNo ()- 1 ,
325+ dom_import_simplexml ($ action )->getLineNo () - 1 ,
321326 self ::ERROR_CODE_HELPER_ATTRIBUTE_CHARACTER_NOT_ALLOWED
322327 );
323328 }
329+
324330 if (strpos ($ this ->getAttribute ($ action , 'helper ' ), ':: ' ) === false ) {
325331 $ phpcsFile ->addError (
326332 "'helper' attribute does not contain '::' " ,
327- dom_import_simplexml ($ action )->getLineNo ()- 1 ,
333+ dom_import_simplexml ($ action )->getLineNo () - 1 ,
328334 self ::ERROR_CODE_HELPER_ATTRIBUTE_CHARACTER_EXPECTED
329335 );
330336 }
@@ -344,7 +350,7 @@ private function testListText(SimpleXMLElement $layout, File $phpcsFile): void
344350 $ phpcsFile ->addError (
345351 'The class \Magento\Framework\View\Element\Text\ListText ' .
346352 ' is not supposed to be used in layout anymore. ' ,
347- dom_import_simplexml ($ elements [0 ])->getLineNo ()- 1 ,
353+ dom_import_simplexml ($ elements [0 ])->getLineNo () - 1 ,
348354 self ::ERROR_CODE_OBSOLETE_CLASS
349355 );
350356 }
@@ -366,7 +372,7 @@ private function testActionNodeMethods(SimpleXMLElement $layout, File $phpcsFile
366372 'Call of method "%s" via layout instruction <action> is not allowed. ' ,
367373 $ attributes ['method ' ]
368374 ),
369- dom_import_simplexml ($ node )->getLineNo ()- 1 ,
375+ dom_import_simplexml ($ node )->getLineNo () - 1 ,
370376 self ::ERROR_CODE_METHOD_NOT_ALLOWED
371377 );
372378 }
0 commit comments