Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed bug #19546 : Error thrown for __call() method in traits

  • Loading branch information...
commit 5fed8ba528af3c5e6df6db47792d3cf32566747b 1 parent d2b3350
Greg Sherwood gsherwood authored
3  CodeSniffer/Standards/Generic/Sniffs/NamingConventions/CamelCapsFunctionNameSniff.php
View
@@ -55,6 +55,7 @@ class Generic_Sniffs_NamingConventions_CamelCapsFunctionNameSniff extends PHP_Co
'set_state',
'clone',
'invoke',
+ 'call',
);
/**
@@ -77,7 +78,7 @@ class Generic_Sniffs_NamingConventions_CamelCapsFunctionNameSniff extends PHP_Co
*/
public function __construct()
{
- parent::__construct(array(T_CLASS, T_INTERFACE), array(T_FUNCTION), true);
+ parent::__construct(array(T_CLASS, T_INTERFACE, T_TRAIT), array(T_FUNCTION), true);
}//end __construct()
10 CodeSniffer/Standards/Generic/Tests/NamingConventions/CamelCapsFunctionNameUnitTest.inc
View
@@ -51,6 +51,7 @@ class Magic_Test {
function __invoke() {}
function __myFunction() {}
function __my_function() {}
+ function __call() {}
}
function __construct() {}
@@ -70,6 +71,7 @@ function __autoload() {}
function __invoke() {}
function __myFunction() {}
function __my_function() {}
+function __call() {}
class Closure_Test {
function test() {
@@ -87,4 +89,10 @@ class MyClass
/* @codingStandardsIgnoreEnd */
public function __construct() {}
}
-?>
+
+trait Foo
+{
+ function __call() {}
+}
+
+?>
75 CodeSniffer/Standards/Generic/Tests/NamingConventions/CamelCapsFunctionNameUnitTest.php
View
@@ -40,39 +40,48 @@ class Generic_Tests_NamingConventions_CamelCapsFunctionNameUnitTest extends Abst
*/
public function getErrorList()
{
- return array(
- 10 => 1,
- 11 => 1,
- 12 => 1,
- 13 => 1,
- 16 => 1,
- 17 => 1,
- 20 => 1,
- 21 => 1,
- 24 => 1,
- 25 => 1,
- 30 => 1,
- 31 => 1,
- 50 => 1,
- 52 => 1,
- 53 => 1,
- 56 => 1,
- 57 => 1,
- 58 => 1,
- 59 => 1,
- 60 => 1,
- 61 => 1,
- 62 => 1,
- 63 => 1,
- 64 => 1,
- 65 => 1,
- 66 => 1,
- 67 => 1,
- 68 => 1,
- 70 => 1,
- 71 => 1,
- 72 => 1,
- );
+ $errors = array(
+ 10 => 1,
+ 11 => 1,
+ 12 => 1,
+ 13 => 1,
+ 16 => 1,
+ 17 => 1,
+ 20 => 1,
+ 21 => 1,
+ 24 => 1,
+ 25 => 1,
+ 30 => 1,
+ 31 => 1,
+ 50 => 1,
+ 52 => 1,
+ 53 => 1,
+ 57 => 1,
+ 58 => 1,
+ 59 => 1,
+ 60 => 1,
+ 61 => 1,
+ 62 => 1,
+ 63 => 1,
+ 64 => 1,
+ 65 => 1,
+ 66 => 1,
+ 67 => 1,
+ 68 => 1,
+ 69 => 1,
+ 71 => 1,
+ 72 => 1,
+ 73 => 1,
+ 74 => 1,
+ );
+
+ // The trait tests will only work in PHP version where traits exist and
+ // will throw errors in earlier versions.
+ if (version_compare(PHP_VERSION, '5.4.0') < 0) {
+ $errors[95] = 1;
+ }
+
+ return $errors;
}//end getErrorList()
1  package.xml
View
@@ -51,6 +51,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
- Fixed bug #19502 : Generic.Files.LineEndingsSniff fails if no new-lines in file
- Fixed bug #19508 : switch+return: Closing brace indented incorrectly
- Fixed bug #19532 : The PSR-2 standard don't recognize Null in class names
+ - Fixed bug #19546 : Error thrown for __call() method in traits
</notes>
<contents>
<dir name="/">
Please sign in to comment.
Something went wrong with that request. Please try again.