3
3
* Copyright © Magento. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+
6
7
namespace Magento \Sniffs \Templates ;
7
8
8
9
use PHP_CodeSniffer \Sniffs \Sniff ;
@@ -34,15 +35,6 @@ class ThisInTemplateSniff implements Sniff
34
35
*/
35
36
protected $ warningCode = 'FoundThis ' ;
36
37
37
- /**
38
- * List of methods, allowed to called via $this.
39
- *
40
- * @var array
41
- */
42
- protected $ allowedMethods = [
43
- 'helper ' ,
44
- ];
45
-
46
38
/**
47
39
* @inheritdoc
48
40
*/
@@ -58,15 +50,7 @@ public function process(File $phpcsFile, $stackPtr)
58
50
{
59
51
$ tokens = $ phpcsFile ->getTokens ();
60
52
if ($ tokens [$ stackPtr ]['content ' ] === '$this ' ) {
61
- $ endOfStatementPtr = $ phpcsFile ->findEndOfStatement ($ stackPtr );
62
- $ functionPtr = $ phpcsFile ->findNext (T_STRING , $ stackPtr , $ endOfStatementPtr );
63
- if ($ functionPtr !== false ) {
64
- if (!in_array ($ tokens [$ functionPtr ]['content ' ], $ this ->allowedMethods )) {
65
- $ phpcsFile ->addWarning ($ this ->warningMessage , $ stackPtr , $ this ->warningCode , [], $ this ->severity );
66
- }
67
- } else {
68
- $ phpcsFile ->addWarning ($ this ->warningMessage , $ stackPtr , $ this ->warningCode , [], $ this ->severity );
69
- }
53
+ $ phpcsFile ->addWarning ($ this ->warningMessage , $ stackPtr , $ this ->warningCode , [], $ this ->severity );
70
54
}
71
55
}
72
56
}
0 commit comments