Skip to content

Commit cfca53a

Browse files
committed
Classes/DisallowFinalClassSniff: fix incorrect recording of metrics
1 parent 7491842 commit cfca53a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Universal/Sniffs/Classes/DisallowFinalClassSniff.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ public function process(File $phpcsFile, $stackPtr)
5656
*/
5757
$classProp = BCFile::getClassProperties($phpcsFile, $stackPtr);
5858
if ($classProp['is_final'] === false) {
59-
if ($classProp['is_abstract'] === false) {
59+
if ($classProp['is_abstract'] === true) {
6060
$phpcsFile->recordMetric($stackPtr, 'Class declaration type', 'abstract');
6161
}
6262

63-
$phpcsFile->recordMetric($stackPtr, 'Class declaration type', 'final');
63+
$phpcsFile->recordMetric($stackPtr, 'Class declaration type', 'not abstract, not final');
6464
return;
6565
}
6666

@@ -70,7 +70,7 @@ public function process(File $phpcsFile, $stackPtr)
7070
return;
7171
}
7272

73-
$phpcsFile->recordMetric($stackPtr, 'Class declaration type', 'not abstract, not final');
73+
$phpcsFile->recordMetric($stackPtr, 'Class declaration type', 'final');
7474

7575
// No extra safeguards needed, we know the keyword will exist based on the check above.
7676
$finalKeyword = $phpcsFile->findPrevious(\T_FINAL, ($stackPtr - 1));

0 commit comments

Comments
 (0)