Skip to content

Commit f9dc5f9

Browse files
Feedback changes
1 parent d2bd683 commit f9dc5f9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Magento2/Sniffs/CodeAnalysis/EmptyBlockSniff.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)