Skip to content

Commit 5182dca

Browse files
committed
#121: Magento2.Templates.HelperInTemplate Rule
1 parent 71235db commit 5182dca

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

Magento2/Sniffs/Templates/ThisInTemplateSniff.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Copyright © Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
namespace Magento2\Sniffs\Templates;
87

98
use PHP_CodeSniffer\Sniffs\Sniff;
@@ -26,7 +25,7 @@ class ThisInTemplateSniff implements Sniff
2625
*
2726
* @var string
2827
*/
29-
protected $warningMessageFoundHelper = 'Usage of helpers in templates is discouraged.';
28+
protected $warningMessageFoundHelper = 'The use of helpers in templates is discouraged. Use ViewModel instead.';
3029

3130
/**
3231
* Warning violation code.
@@ -40,17 +39,14 @@ class ThisInTemplateSniff implements Sniff
4039
*
4140
* @var string
4241
*/
43-
protected $warningMessageFoundThis = 'Usage of $this in template files is deprecated.';
42+
protected $warningMessageFoundThis = 'The use of $this in templates is deprecated. Use $block instead.';
4443

4544
/**
4645
* @inheritdoc
4746
*/
4847
public function register()
4948
{
50-
return [
51-
T_VARIABLE,
52-
T_STRING,
53-
];
49+
return [T_VARIABLE];
5450
}
5551

5652
/**

0 commit comments

Comments
 (0)