Skip to content

Commit e96c4cc

Browse files
author
roettigl
committed
#147: Fix for files that contain phtml
1 parent 8aa173c commit e96c4cc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Magento2/Sniffs/Templates/ThisInTemplateSniff.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ public function register()
5454
*/
5555
public function process(File $phpcsFile, $stackPtr)
5656
{
57+
$name = $phpcsFile->getFilename();
58+
if (strpos($name, '.php', strlen($name) - 4) !== false) {
59+
// file is from type .php do nothing
60+
return;
61+
}
62+
5763
$tokens = $phpcsFile->getTokens();
5864
if ($tokens[$stackPtr]['content'] === '$this') {
5965
$position = $phpcsFile->findNext(T_STRING, $stackPtr, null, false, 'helper', true);

0 commit comments

Comments
 (0)