Permalink
Browse files

Private Variables Fix

Private variables require double underscore (__), however the
isValidVar does not account for private variables. It only allows for
protected  variables with a single underscore. This will resolve the
private variable check.
  • Loading branch information...
1 parent 4f5ce7b commit 606d4b881b54afb7fdb7ea30704177e92012432a @cdburgess cdburgess committed Mar 27, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 Sniffs/NamingConventions/ValidVariableNameSniff.php
@@ -271,6 +271,10 @@ protected function isValidVar($string, $public = true)
if (preg_match("|^$firstChar|", $string) === 0) {
return false;
}
+ $firstStringCount = 1;
+ if (preg_match("|^__|", $string)) {
+ $firstStringCount = 2;
+ }
// Check that the name only contains legal characters.
$legalChars = 'a-zA-Z0-9';
if (preg_match("|[^$legalChars]|", substr($string, 1)) > 0) {

0 comments on commit 606d4b8

Please sign in to comment.