diff --git a/src/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php b/src/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php index 151cb7d5c1..4585c97349 100644 --- a/src/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php +++ b/src/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php @@ -644,7 +644,7 @@ public function process(File $phpcsFile, $stackPtr) } $conditionToken = array_pop($openScopes); - if ($this->debug === true) { + if ($this->debug === true && $conditionToken !== null) { $line = $tokens[$conditionToken]['line']; $type = $tokens[$conditionToken]['type']; echo "\t=> removed open scope $conditionToken ($type) on line $line".PHP_EOL;