Skip to content
Browse files

Fixed bug #20138 : Protected property underscore and camel caps issue…

… (in trait with Zend)
  • Loading branch information...
1 parent 518a927 commit b574c8465331ac48e7c96fa175ef3ac40b92855b @gsherwood gsherwood committed
Showing with 4 additions and 2 deletions.
  1. +2 −2 CodeSniffer/Standards/Zend/Sniffs/NamingConventions/ValidVariableNameSniff.php
  2. +2 −0 package.xml
View
4 CodeSniffer/Standards/Zend/Sniffs/NamingConventions/ValidVariableNameSniff.php
@@ -119,7 +119,7 @@ protected function processVariable(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
// this: MyClass::$_variable, so we don't know its scope.
$inClass = true;
} else {
- $inClass = $phpcsFile->hasCondition($stackPtr, array(T_CLASS, T_INTERFACE));
+ $inClass = $phpcsFile->hasCondition($stackPtr, array(T_CLASS, T_INTERFACE, T_TRAIT));
}
if ($inClass === true) {
@@ -226,7 +226,7 @@ protected function processVariableInString(PHP_CodeSniffer_File $phpcsFile, $sta
// check the main part of the variable name.
$originalVarName = $varName;
if (substr($varName, 0, 1) === '_') {
- if ($phpcsFile->hasCondition($stackPtr, array(T_CLASS, T_INTERFACE)) === true) {
+ if ($phpcsFile->hasCondition($stackPtr, array(T_CLASS, T_INTERFACE, T_TRAIT)) === true) {
$varName = substr($varName, 1);
}
}
View
2 package.xml
@@ -29,6 +29,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
- Generic ForbiddenFunctionsSniff now ignores object creation
-- This is a further fix for bug #20100 : incorrect Function mysql() has been deprecated report
- Fixed bug #20136 : Squiz_Sniffs_WhiteSpace_ScopeKeywordSpacingSniff and Traits
+ - Fixed bug #20138 : Protected property underscore and camel caps issue (in trait with Zend)
+ -- Thanks to Gaetan Rousseau for the patch
</notes>
<contents>
<dir name="/">

0 comments on commit b574c84

Please sign in to comment.
Something went wrong with that request. Please try again.