Skip to content

Commit

Permalink
Allowing underscored public methods in controllers. Fix #2
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed Mar 17, 2012
1 parent 595e660 commit b3da292
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sniffs/NamingConventions/ValidFunctionNameSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ protected function processTokenWithinScope(PHP_CodeSniffer_File $phpcsFile, $sta
$phpcsFile->addError($error, $stackPtr, 'PublicWithUnderscore', $errorData);
return;
}
// Underscored public methods in controller are allowed to break our rules.
if (substr($className, -10) === 'Controller') {
return;
}
} elseif ($isPrivate === true) {
if (substr($methodName, 0, 2) !== '__') {
$error = 'Private method name "%s" must be prefixed with 2 underscores';
Expand Down

0 comments on commit b3da292

Please sign in to comment.