diff --git a/src/Standards/Generic/Sniffs/Metrics/NestingLevelSniff.php b/src/Standards/Generic/Sniffs/Metrics/NestingLevelSniff.php index 3c086c7fe4..d2672b5eeb 100644 --- a/src/Standards/Generic/Sniffs/Metrics/NestingLevelSniff.php +++ b/src/Standards/Generic/Sniffs/Metrics/NestingLevelSniff.php @@ -56,8 +56,8 @@ public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); - // Ignore abstract methods. - if (isset($tokens[$stackPtr]['scope_opener']) === false) { + // Ignore abstract and interface methods. Bail early when live coding. + if (isset($tokens[$stackPtr]['scope_opener'], $tokens[$stackPtr]['scope_closer']) === false) { return; }