Skip to content

Commit 1042b40

Browse files
committed
Generic/CyclomaticComplexity: improve code coverage
1 parent dbc1663 commit 1042b40

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/Standards/Generic/Sniffs/Metrics/CyclomaticComplexitySniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function process(File $phpcsFile, $stackPtr)
6060
{
6161
$tokens = $phpcsFile->getTokens();
6262

63-
// Ignore abstract methods.
63+
// Ignore abstract and interface methods. Bail early when live coding.
6464
if (isset($tokens[$stackPtr]['scope_opener']) === false) {
6565
return;
6666
}

src/Standards/Generic/Tests/Metrics/CyclomaticComplexityUnitTest.1.inc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,4 +451,10 @@ function complexityElevenWithNullSafeOperator()
451451
$bits = $object5->getX()?->getY()?->getZ();
452452
}
453453

454-
?>
454+
abstract class AbstractClass {
455+
abstract public function sniffShouldIgnoreAbstractMethods();
456+
}
457+
458+
interface MyInterface {
459+
public function sniffShouldIgnoreInterfaceMethods();
460+
}

0 commit comments

Comments
 (0)