Using own Code-Sytle ;)
This commit is contained in:
parent
308391d6c7
commit
967e61c6c6
3 changed files with 19 additions and 18 deletions
|
@ -30,7 +30,7 @@ class VarIsLastTagOnPropertySniff extends AbstractVariableSniff
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$propertyInfo = $phpcsFile->getMemberProperties($stackPtr);
|
$propertyInfo = $phpcsFile->getMemberProperties($stackPtr);
|
||||||
if (empty($propertyInfo) === true) {
|
if ($propertyInfo === []) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
@ -39,21 +39,22 @@ class VarIsLastTagOnPropertySniff extends AbstractVariableSniff
|
||||||
}
|
}
|
||||||
$tokens = $phpcsFile->getTokens();
|
$tokens = $phpcsFile->getTokens();
|
||||||
$ignore = [
|
$ignore = [
|
||||||
T_PUBLIC,
|
\T_PUBLIC,
|
||||||
T_PRIVATE,
|
\T_PRIVATE,
|
||||||
T_PROTECTED,
|
\T_PROTECTED,
|
||||||
T_VAR,
|
\T_VAR,
|
||||||
T_STATIC,
|
\T_STATIC,
|
||||||
T_WHITESPACE,
|
\T_WHITESPACE,
|
||||||
T_STRING,
|
\T_STRING,
|
||||||
T_NS_SEPARATOR,
|
\T_NS_SEPARATOR,
|
||||||
T_NULLABLE,
|
\T_NULLABLE,
|
||||||
];
|
];
|
||||||
|
|
||||||
$commentEnd = $phpcsFile->findPrevious($ignore, ($stackPtr - 1), null, true);
|
$commentEnd = $phpcsFile->findPrevious($ignore, ($stackPtr - 1), null, true);
|
||||||
if ($commentEnd === false
|
if (
|
||||||
|| ($tokens[$commentEnd]['code'] !== T_DOC_COMMENT_CLOSE_TAG
|
$commentEnd === false
|
||||||
&& $tokens[$commentEnd]['code'] !== T_COMMENT)
|
|| ($tokens[$commentEnd]['code'] !== \T_DOC_COMMENT_CLOSE_TAG
|
||||||
|
&& $tokens[$commentEnd]['code'] !== \T_COMMENT)
|
||||||
) {
|
) {
|
||||||
// Obviously, there is NO comment at all, we are done
|
// Obviously, there is NO comment at all, we are done
|
||||||
return;
|
return;
|
||||||
|
@ -96,7 +97,7 @@ class VarIsLastTagOnPropertySniff extends AbstractVariableSniff
|
||||||
File $phpcsFile,
|
File $phpcsFile,
|
||||||
int $commentEnd
|
int $commentEnd
|
||||||
): void {
|
): void {
|
||||||
$nextTokenIndex = array_search($varToken, $commentTags) + 1;
|
$nextTokenIndex = \array_search($varToken, $commentTags) + 1;
|
||||||
$nextToken = $commentTags[$nextTokenIndex];
|
$nextToken = $commentTags[$nextTokenIndex];
|
||||||
// subtracting four tokens (whitespace + "*" + whitespace + newline) as we already know, we are not last
|
// subtracting four tokens (whitespace + "*" + whitespace + newline) as we already know, we are not last
|
||||||
$varContent = $phpcsFile->getTokensAsString($varToken - 4, $nextToken - $varToken);
|
$varContent = $phpcsFile->getTokensAsString($varToken - 4, $nextToken - $varToken);
|
||||||
|
|
|
@ -54,8 +54,8 @@ abstract class AbstractMissingPrefixSniff implements Sniff
|
||||||
$stackPtr,
|
$stackPtr,
|
||||||
$this->getErrorCode(),
|
$this->getErrorCode(),
|
||||||
[
|
[
|
||||||
$prefix,
|
$prefix,
|
||||||
$className,
|
$className,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,8 @@ abstract class AbstractMissingSuffixSniff implements Sniff
|
||||||
$stackPtr,
|
$stackPtr,
|
||||||
$this->getErrorCode(),
|
$this->getErrorCode(),
|
||||||
[
|
[
|
||||||
$suffix,
|
$suffix,
|
||||||
$className,
|
$className,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue