Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Change code style

Enforce no underscore prefixing private member vars.
  • Loading branch information...
commit ecf901b23899ccfd3f92ae30d6c7a4d666616197 1 parent 9dc3b8c
@elkuku elkuku authored
Showing with 2 additions and 11 deletions.
  1. +2 −11 Sniffs/NamingConventions/ValidVariableNameSniff.php
View
13 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),
Please sign in to comment.
Something went wrong with that request. Please try again.