| @@ 135-143 (lines=9) @@ | ||
| 132 | } |
|
| 133 | ||
| 134 | // If it's not a private method, it must not have an underscore on the front. |
|
| 135 | if ($scope !== 'private' && $methodName{0} === '_') { |
|
| 136 | if (true === $scopeSpecified) { |
|
| 137 | $error = "Public method name \"$className::$methodName\" must not be prefixed with an underscore"; |
|
| 138 | } else { |
|
| 139 | $error = ucfirst($scope)." method name \"$className::$methodName\" must not be prefixed with an underscore"; |
|
| 140 | } |
|
| 141 | $phpcsFile->addError($error, $stackPtr); |
|
| 142 | return; |
|
| 143 | } |
|
| 144 | ||
| 145 | // If name is too verbose, |
|
| 146 | // then either an error or a warning is displayed. |
|
| @@ 201-211 (lines=11) @@ | ||
| 198 | $error = "Private variable name \"$varName\" must be prefixed with an underscore"; |
|
| 199 | $phpcsFile->addError($error, $stackPtr); |
|
| 200 | $isVisibilityPrefixRight = false; |
|
| 201 | } else if ($scope !== 'private' && $varName{0} === '_') { |
|
| 202 | // If it's not a private variable, |
|
| 203 | // then it must not start with an underscore. |
|
| 204 | if (isset ($scopeSpecified) && true === $scopeSpecified) { |
|
| 205 | $error = "Public variable name \"$varName\" must not be prefixed with an underscore"; |
|
| 206 | } else { |
|
| 207 | $error = ucfirst($scope) . " variable name \"$varName\" must not be prefixed with an underscore"; |
|
| 208 | } |
|
| 209 | $phpcsFile->addError($error, $stackPtr); |
|
| 210 | $isVisibilityPrefixRight = false; |
|
| 211 | } |
|
| 212 | return $isVisibilityPrefixRight; |
|
| 213 | }//end checkVisibilityPrefix() |
|
| 214 | ||