Skip to content

#95 : Empty FUNCTION statement detected should be allowed for around plugins #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 9, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Feedback changes
  • Loading branch information
konarshankar07 committed Aug 9, 2019
commit 8ef3eeb12402ce42b5dae0ffb3b8b19a4998949f
8 changes: 2 additions & 6 deletions Magento2/Sniffs/CodeAnalysis/EmptyBlockSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,8 @@ public function register()
public function process(File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
$posOfString = $phpcsFile->findNext(T_STRING, $stackPtr);
$stringContent = $tokens[$posOfString]['content'];
/** Check if function starts with around and also checked if string length
* greater than 6 so that exact blank function name 'around()' give us warning
*/
if (substr($stringContent, 0, 6) === "around" && strlen($stringContent) > 6) {
if ($tokens[$stackPtr]['code'] === T_FUNCTION &&
strpos($phpcsFile->getDeclarationName($stackPtr), 'around') === 0) {
return;
}

Expand Down