Skip to content

Commit 203e8af

Browse files
committed
AC-681: Create phpcs static check for PhtmlTemplateTest
1 parent a5dff74 commit 203e8af

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

Magento2/Sniffs/Legacy/PhtmlTemplateSniff.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ class PhtmlTemplateSniff implements Sniff
1010
private const WARNING_CODE = 'PhtmlTemplateObsolete';
1111

1212
private const OBSOLETE_REGEX_IN_SPECIFIC_PHTML_TEMPLATES = [
13-
'/(["\'])jquery\/ui\1/' => 'Please do not use "jquery/ui" library in templates. Use needed jquery ' .
13+
'/(["\'])jquery\/ui\1/' => 'Please do not use "jquery/ui" library in templates. Use needed jquery ' .
1414
'ui widget instead.',
15-
'/data-mage-init=(?:\'|")(?!\s*{\s*"[^"]+")/' => 'Please do not initialize JS component in php. Do ' .
15+
'/data-mage-init=(?:\'|")(?!\s*{\s*"[^"]+")/' => 'Please do not initialize JS component in php. Do ' .
1616
'it in template.',
17-
'@x-magento-init.>(?!\s*+{\s*"[^"]+"\s*:\s*{\s*"[\w/-]+")@i' => 'Please do not initialize JS component ' .
17+
'@x-magento-init.>(?!\s*+{\s*"[^"]+"\s*:\s*{\s*"[\w/-]+")@i' => 'Please do not initialize JS component ' .
1818
'in php. Do it in template.',
1919
];
2020

@@ -54,6 +54,8 @@ public function process(File $phpcsFile, $stackPtr)
5454
}
5555

5656
/**
57+
* Check access to protected and private members of Block
58+
*
5759
* @param File $phpcsFile
5860
* @param int $stackPtr
5961
* @param array $tokens
@@ -76,6 +78,8 @@ private function checkBlockVariable(File $phpcsFile, int $stackPtr, array $token
7678
}
7779

7880
/**
81+
* Check access to members and methods of Block class through $this
82+
*
7983
* @param File $phpcsFile
8084
* @param int $stackPtr
8185
* @param array $tokens
@@ -98,6 +102,8 @@ private function checkThisVariable(File $phpcsFile, int $stackPtr, array $tokens
98102
}
99103

100104
/**
105+
* Check use of "text/javascript" type
106+
*
101107
* @param File $phpcsFile
102108
* @param int $stackPtr
103109
*/
@@ -115,6 +121,8 @@ private function checkHtml(File $phpcsFile, int $stackPtr): void
115121
}
116122

117123
/**
124+
* Check of some obsoletes uses in specific files
125+
*
118126
* @param File $phpcsFile
119127
* @param int $stackPtr
120128
*/
@@ -132,5 +140,4 @@ private function checkHtmlSpecificFiles(File $phpcsFile, int $stackPtr): void
132140
}
133141
}
134142
}
135-
136143
}

0 commit comments

Comments
 (0)