From 967e61c6c6552e12d9cedc22c7f569f4e3936383 Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Sun, 1 May 2022 00:22:02 +0200 Subject: [PATCH] Using own Code-Sytle ;) --- .../VarIsLastTagOnPropertySniff.php | 29 ++++++++++--------- .../ClassNames/AbstractMissingPrefixSniff.php | 4 +-- .../ClassNames/AbstractMissingSuffixSniff.php | 4 +-- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/DigiComp/Sniffs/Annotations/VarIsLastTagOnPropertySniff.php b/src/DigiComp/Sniffs/Annotations/VarIsLastTagOnPropertySniff.php index aac22cc..1066317 100644 --- a/src/DigiComp/Sniffs/Annotations/VarIsLastTagOnPropertySniff.php +++ b/src/DigiComp/Sniffs/Annotations/VarIsLastTagOnPropertySniff.php @@ -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); diff --git a/src/DigiComp/Sniffs/ClassNames/AbstractMissingPrefixSniff.php b/src/DigiComp/Sniffs/ClassNames/AbstractMissingPrefixSniff.php index 7d34364..ed4a4bf 100644 --- a/src/DigiComp/Sniffs/ClassNames/AbstractMissingPrefixSniff.php +++ b/src/DigiComp/Sniffs/ClassNames/AbstractMissingPrefixSniff.php @@ -54,8 +54,8 @@ abstract class AbstractMissingPrefixSniff implements Sniff $stackPtr, $this->getErrorCode(), [ - $prefix, - $className, + $prefix, + $className, ] ); } diff --git a/src/DigiComp/Sniffs/ClassNames/AbstractMissingSuffixSniff.php b/src/DigiComp/Sniffs/ClassNames/AbstractMissingSuffixSniff.php index ef3841b..4749f86 100644 --- a/src/DigiComp/Sniffs/ClassNames/AbstractMissingSuffixSniff.php +++ b/src/DigiComp/Sniffs/ClassNames/AbstractMissingSuffixSniff.php @@ -54,8 +54,8 @@ abstract class AbstractMissingSuffixSniff implements Sniff $stackPtr, $this->getErrorCode(), [ - $suffix, - $className, + $suffix, + $className, ] ); }