File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Magento2/Sniffs/CodeAnalysis Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -31,10 +31,13 @@ public function register()
3131 */
3232 public function process (File $ phpcsFile , $ stackPtr )
3333 {
34- $ posOfFunction = $ phpcsFile ->findNext ([T_FUNCTION ], $ stackPtr );
35- $ functionName = $ phpcsFile ->getDeclarationName ($ posOfFunction );
36- // Skip for around function
37- if (strpos ($ functionName , 'around ' ) !== false ) {
34+ $ tokens = $ phpcsFile ->getTokens ();
35+ $ posOfString = $ phpcsFile ->findNext (T_STRING , $ stackPtr );
36+ $ stringContent = $ tokens [$ posOfString ]['content ' ];
37+ /** Check if function starts with around and also checked if string length
38+ * greater than 6 so that exact blank function name 'around()' give us warning
39+ */
40+ if (substr ($ stringContent , 0 , 6 ) === "around " && strlen ($ stringContent ) > 6 ) {
3841 return ;
3942 }
4043
You can’t perform that action at this time.
0 commit comments