Skip to content

Commit

Permalink
Generic/CyclomaticComplexity: improve code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigoprimo committed Nov 19, 2024
1 parent dbc1663 commit da0f04b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function process(File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();

// Ignore abstract methods.
// Ignore abstract and interface methods. Bail early when live coding.
if (isset($tokens[$stackPtr]['scope_opener']) === false) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,4 +451,10 @@ function complexityElevenWithNullSafeOperator()
$bits = $object5->getX()?->getY()?->getZ();
}

?>
abstract class AbstractClass {
abstract public function sniffShouldIgnoreAbstractMethods();
}

interface MyInterface {
public function sniffShouldIgnoreInterfaceMethods();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

// Intentional parse error (missing opening curly bracket).
// This should be the only test in this file.
// Testing that the sniff is *not* triggered.

function sniffShouldBailMissingScopeOpener()

0 comments on commit da0f04b

Please sign in to comment.