Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fde7fc5

Browse filesBrowse files
authored
Merge pull request magento#126 from konarshankar07/95_empty_function_around
magento#95 : Empty FUNCTION statement detected should be allowed for around plugins
2 parents d24e023 + 8ef3eeb commit fde7fc5
Copy full SHA for fde7fc5

File tree

Expand file treeCollapse file tree

2 files changed

+16
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+16
-0
lines changed

‎Magento2/Sniffs/CodeAnalysis/EmptyBlockSniff.php

Copy file name to clipboardExpand all lines: Magento2/Sniffs/CodeAnalysis/EmptyBlockSniff.php
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento2\Sniffs\CodeAnalysis;
77

8+
use PHP_CodeSniffer\Files\File;
89
use PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\EmptyStatementSniff;
910

1011
/**
@@ -25,4 +26,17 @@ public function register()
2526
]
2627
);
2728
}
29+
/**
30+
* @inheritDoc
31+
*/
32+
public function process(File $phpcsFile, $stackPtr)
33+
{
34+
$tokens = $phpcsFile->getTokens();
35+
if ($tokens[$stackPtr]['code'] === T_FUNCTION &&
36+
strpos($phpcsFile->getDeclarationName($stackPtr), 'around') === 0) {
37+
return;
38+
}
39+
40+
parent::process($phpcsFile, $stackPtr);
41+
}//end process()
2842
}

‎Magento2/Tests/CodeAnalysis/EmptyBlockUnitTest.inc

Copy file name to clipboardExpand all lines: Magento2/Tests/CodeAnalysis/EmptyBlockUnitTest.inc
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,5 @@ if (true) {} elseif (false) {}
7474
function emptyFunction () { /*Empty function block*/ }
7575

7676
function nonEmptyFunction () { return true; }
77+
78+
function aroundEmptyFunction ($foo, $bar) { }

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.