Skip to content

Commit

Permalink
Fixed bug #663 : No space after class name generates: Class name is n…
Browse files Browse the repository at this point in the history
…ot in camel caps format
  • Loading branch information
gsherwood committed Jul 31, 2015
1 parent b3b9016 commit 0a474f9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
$opener = $tokens[$stackPtr]['scope_opener'];
$nameStart = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), $opener, true);
$nameEnd = $phpcsFile->findNext(T_WHITESPACE, $nameStart, $opener);
$name = trim($phpcsFile->getTokensAsString($nameStart, ($nameEnd - $nameStart)));
if ($nameEnd === false) {
$name = $tokens[$nameStart]['content'];
} else {
$name = trim($phpcsFile->getTokensAsString($nameStart, ($nameEnd - $nameStart)));
}

// Check for camel caps format.
$valid = PHP_CodeSniffer::isCamelCaps($name, true, true, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ class 5InvalidCamelCaseClassStartingWithNumber extends MyClass {}
class ValidCamelCaseClassEndingWithNumber5 extends MyClass {}
class 12345 extends MyClass {}


?>
class Testing{}
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
- Fixed bug #644 : PEAR ScopeClosingBrace sniff does not work with mixed HTML/PHP
- Fixed bug #645 : FunctionSignature and ScopeIndent sniffs don't detect indents correctly when PHP open tag is not on a line by itself
- Fixed bug #654 : Comments affect indent check for BSDAllman brace style
- Fixed bug #663 : No space after class name generates: Class name "" is not in camel caps format
</notes>
<contents>
<dir name="/">
Expand Down

1 comment on commit 0a474f9

@LucasMali
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are awesome!

Please sign in to comment.