Skip to content

Commit a520b9a

Browse files
committed
Merge branch 'fix/SquizMethodScopeTrait' of https://github.com/donatj/PHP_CodeSniffer
2 parents 26d3516 + 8df7fe9 commit a520b9a

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

CodeSniffer/Standards/Squiz/Sniffs/Scope/MethodScopeSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Squiz_Sniffs_Scope_MethodScopeSniff extends PHP_CodeSniffer_Standards_Abst
3838
*/
3939
public function __construct()
4040
{
41-
parent::__construct(array(T_CLASS, T_INTERFACE), array(T_FUNCTION));
41+
parent::__construct(array(T_CLASS, T_INTERFACE, T_TRAIT), array(T_FUNCTION));
4242

4343
}//end __construct()
4444

CodeSniffer/Standards/Squiz/Tests/Scope/MethodScopeUnitTest.inc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,10 @@ class Closure_Test {
2525
function test() {
2626
$foo = function() { echo 'foo'; };
2727
}
28+
29+
trait Trait_Test {
30+
function func1() {}
31+
public function func1() {}
32+
private function func1() {}
33+
protected function func1() {}
34+
}

CodeSniffer/Standards/Squiz/Tests/Scope/MethodScopeUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public function getErrorList()
4444
{
4545
return array(
4646
6 => 1,
47+
30 => 1,
4748
);
4849

4950
}//end getErrorList()

0 commit comments

Comments
 (0)