WIP|FEATURE: Handle trait and interfaces beside classes

* Also fix check whether another line should be added after namespace
  definition.

Relates: #36
This commit is contained in:
Daniel Siepmann 2017-03-21 17:22:18 +01:00
parent fcb778d903
commit 21c72c8b96
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4

View file

@ -34,7 +34,11 @@ class Typo3Update_Sniffs_LegacyClassnames_MissingNamespaceSniff extends Abstract
*/
public function register()
{
return [T_CLASS];
return [
T_CLASS,
T_INTERFACE,
T_TRAIT,
];
}
/**
@ -97,8 +101,7 @@ class Typo3Update_Sniffs_LegacyClassnames_MissingNamespaceSniff extends Abstract
$lineEndings = PhpCsFile::detectLineEndings($phpcsFile->getFilename());
$suffix = $lineEndings;
// TODO, does not work.
if ($tokens[1] === "\n") {
if ($tokens[1]['code'] !== T_WHITESPACE) {
$suffix .= $lineEndings;
}