Using own Code-Sytle ;)

This commit is contained in:
Ferdinand Kuhl 2022-05-01 00:22:02 +02:00
parent 308391d6c7
commit 967e61c6c6
3 changed files with 19 additions and 18 deletions

View file

@ -30,7 +30,7 @@ class VarIsLastTagOnPropertySniff extends AbstractVariableSniff
{
try {
$propertyInfo = $phpcsFile->getMemberProperties($stackPtr);
if (empty($propertyInfo) === true) {
if ($propertyInfo === []) {
return;
}
} catch (\Exception $e) {
@ -39,21 +39,22 @@ class VarIsLastTagOnPropertySniff extends AbstractVariableSniff
}
$tokens = $phpcsFile->getTokens();
$ignore = [
T_PUBLIC,
T_PRIVATE,
T_PROTECTED,
T_VAR,
T_STATIC,
T_WHITESPACE,
T_STRING,
T_NS_SEPARATOR,
T_NULLABLE,
\T_PUBLIC,
\T_PRIVATE,
\T_PROTECTED,
\T_VAR,
\T_STATIC,
\T_WHITESPACE,
\T_STRING,
\T_NS_SEPARATOR,
\T_NULLABLE,
];
$commentEnd = $phpcsFile->findPrevious($ignore, ($stackPtr - 1), null, true);
if ($commentEnd === false
|| ($tokens[$commentEnd]['code'] !== T_DOC_COMMENT_CLOSE_TAG
&& $tokens[$commentEnd]['code'] !== T_COMMENT)
if (
$commentEnd === false
|| ($tokens[$commentEnd]['code'] !== \T_DOC_COMMENT_CLOSE_TAG
&& $tokens[$commentEnd]['code'] !== \T_COMMENT)
) {
// Obviously, there is NO comment at all, we are done
return;
@ -96,7 +97,7 @@ class VarIsLastTagOnPropertySniff extends AbstractVariableSniff
File $phpcsFile,
int $commentEnd
): void {
$nextTokenIndex = array_search($varToken, $commentTags) + 1;
$nextTokenIndex = \array_search($varToken, $commentTags) + 1;
$nextToken = $commentTags[$nextTokenIndex];
// subtracting four tokens (whitespace + "*" + whitespace + newline) as we already know, we are not last
$varContent = $phpcsFile->getTokensAsString($varToken - 4, $nextToken - $varToken);