1
1
<?php
2
+
2
3
/**
3
4
* Copyright © Magento, Inc. All rights reserved.
4
5
* See COPYING.txt for license details.
5
6
*/
6
- declare (strict_types = 1 );
7
+
8
+ declare (strict_types=1 );
7
9
8
10
namespace Magento2 \Sniffs \Legacy ;
9
11
@@ -248,11 +250,12 @@ private function testObsoleteReferences(SimpleXMLElement $layout, File $phpcsFil
248
250
if (!isset ($ this ->obsoleteReferences [$ handleAttribute ])) {
249
251
continue ;
250
252
}
253
+
251
254
foreach ($ handle ->xpath ('//reference | //referenceContainer | //referenceBlock ' ) as $ reference ) {
252
255
if (in_array ((string )$ reference ['name ' ], $ this ->obsoleteReferences [$ handleAttribute ]) !== false ) {
253
256
$ phpcsFile ->addError (
254
257
'The block being referenced is removed. ' ,
255
- dom_import_simplexml ($ reference )->getLineNo ()- 1 ,
258
+ dom_import_simplexml ($ reference )->getLineNo () - 1 ,
256
259
self ::ERROR_CODE_OBSOLETE_BLOCK
257
260
);
258
261
}
@@ -264,6 +267,7 @@ private function testObsoleteReferences(SimpleXMLElement $layout, File $phpcsFil
264
267
* Format the incoming XML to avoid tags split into several lines.
265
268
*
266
269
* @param File $phpcsFile
270
+ *
267
271
* @return false|string
268
272
*/
269
273
private function getFormattedXML (File $ phpcsFile )
@@ -286,7 +290,7 @@ private function testOutputAttribute(SimpleXMLElement $layout, File $phpcsFile):
286
290
if (!empty ($ elements )) {
287
291
$ phpcsFile ->addError (
288
292
'output="toHtml" is obsolete. Use output="1" ' ,
289
- dom_import_simplexml ($ elements [0 ])->getLineNo ()- 1 ,
293
+ dom_import_simplexml ($ elements [0 ])->getLineNo () - 1 ,
290
294
self ::ERROR_CODE_OBSOLETE_TOHTML_ATTRIBUTE
291
295
);
292
296
};
@@ -297,6 +301,7 @@ private function testOutputAttribute(SimpleXMLElement $layout, File $phpcsFile):
297
301
*
298
302
* @param SimpleXMLElement $element
299
303
* @param string $name
304
+ *
300
305
* @return string|null
301
306
*/
302
307
private function getAttribute (SimpleXMLElement $ element , string $ name ): string
@@ -317,14 +322,15 @@ private function testHelperAttribute(SimpleXMLElement $layout, File $phpcsFile):
317
322
if (strpos ($ this ->getAttribute ($ action , 'helper ' ), '/ ' ) !== false ) {
318
323
$ phpcsFile ->addError (
319
324
"'helper' attribute contains '/' " ,
320
- dom_import_simplexml ($ action )->getLineNo ()- 1 ,
325
+ dom_import_simplexml ($ action )->getLineNo () - 1 ,
321
326
self ::ERROR_CODE_HELPER_ATTRIBUTE_CHARACTER_NOT_ALLOWED
322
327
);
323
328
}
329
+
324
330
if (strpos ($ this ->getAttribute ($ action , 'helper ' ), ':: ' ) === false ) {
325
331
$ phpcsFile ->addError (
326
332
"'helper' attribute does not contain '::' " ,
327
- dom_import_simplexml ($ action )->getLineNo ()- 1 ,
333
+ dom_import_simplexml ($ action )->getLineNo () - 1 ,
328
334
self ::ERROR_CODE_HELPER_ATTRIBUTE_CHARACTER_EXPECTED
329
335
);
330
336
}
@@ -344,7 +350,7 @@ private function testListText(SimpleXMLElement $layout, File $phpcsFile): void
344
350
$ phpcsFile ->addError (
345
351
'The class \Magento\Framework\View\Element\Text\ListText ' .
346
352
' 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 ,
348
354
self ::ERROR_CODE_OBSOLETE_CLASS
349
355
);
350
356
}
@@ -366,7 +372,7 @@ private function testActionNodeMethods(SimpleXMLElement $layout, File $phpcsFile
366
372
'Call of method "%s" via layout instruction <action> is not allowed. ' ,
367
373
$ attributes ['method ' ]
368
374
),
369
- dom_import_simplexml ($ node )->getLineNo ()- 1 ,
375
+ dom_import_simplexml ($ node )->getLineNo () - 1 ,
370
376
self ::ERROR_CODE_METHOD_NOT_ALLOWED
371
377
);
372
378
}
0 commit comments