Permalink
Browse files

Merge pull request #17 from elkuku/cs-private-members-no-underscore

Change code style
  • Loading branch information...
2 parents ae5d8b9 + ecf901b commit 005a921c07c1ee1f2f960e2c5d8ace281b2926e7 @eddieajau eddieajau committed Feb 24, 2013
Showing with 2 additions and 11 deletions.
  1. +2 −11 Sniffs/NamingConventions/ValidVariableNameSniff.php
@@ -54,7 +54,6 @@ protected function processMemberVar(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
}
$memberName = ltrim($tokens[$stackPtr]['content'], '$');
- $isPublic = ($memberProps['scope'] === 'private') ? false : true;
$scope = $memberProps['scope'];
$scopeSpecified = $memberProps['scope_specified'];
@@ -88,16 +87,8 @@ protected function processMemberVar(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
$isDeprecated = false;
}
- // If it's a private member, it must have an underscore on the front.
- if ($isPublic === false && $memberName{0} !== '_') {
- $error = 'Private member variable "%s" must be prefixed with an underscore';
- $data = array($memberName);
- $phpcsFile->addError($error, $stackPtr, 'PrivateNoUnderscore', $data);
- return;
- }
-
- // If it's not a private member, it must not have an underscore on the front.
- if ($isDeprecated === false && $isPublic === true && $scopeSpecified === true && $memberName{0} === '_') {
+ // Member vars must not be prefixed by an underscore.
+ if ($isDeprecated === false && $scopeSpecified === true && $memberName{0} === '_') {
$error = '%s member variable "%s" must not be prefixed with an underscore';
$data = array(
ucfirst($scope),

0 comments on commit 005a921

Please sign in to comment.