Skip to content

Commit

Permalink
fix for issue #24
Browse files Browse the repository at this point in the history
  • Loading branch information
ceeram committed Dec 11, 2012
1 parent a2484c5 commit eea7915
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sniffs/NamingConventions/ValidVariableNameSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected function processVariable(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
}

if ($inClass === true) {
$varName = substr($varName, 1);
$varName = ltrim($varName, '_');
}
}

Expand Down
32 changes: 32 additions & 0 deletions tests/files/variable_name_pass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

class VariablenamePass {

public $passing;

public $passingPublic = 'defined';

protected $_underScoredStart = 'OK';

protected $_underScored;

private $__doubleUnderscore = 'applications';

public static $publicStatic = true;

protected static $_protectedStatic = true;

private static $__privateStatic = true;

public function setVariables() {
$this->passingPublic = 'changed';
$this->_underscored = 'has value now';
$this->__doubleUnderscore = 'not recommended';
}

public static function setStatics() {
self::$publicStatic = true;
self::$_protectedStatic = true;
self::$__privateStatic = true;
}
}

0 comments on commit eea7915

Please sign in to comment.