diff --git a/src/Standards/Squiz/Sniffs/PHP/EmbeddedPhpSniff.php b/src/Standards/Squiz/Sniffs/PHP/EmbeddedPhpSniff.php index be75265917..0be6118e43 100644 --- a/src/Standards/Squiz/Sniffs/PHP/EmbeddedPhpSniff.php +++ b/src/Standards/Squiz/Sniffs/PHP/EmbeddedPhpSniff.php @@ -284,7 +284,9 @@ private function validateMultilineEmbeddedPhp($phpcsFile, $stackPtr, $closingTag $phpcsFile->fixer->addNewlineBefore($closingTag); $phpcsFile->fixer->endChangeset(); }//end if - } else if ($tokens[$firstContentAfterBlock]['line'] === $tokens[$closingTag]['line']) { + } else if ($firstContentAfterBlock !== false + && $tokens[$firstContentAfterBlock]['line'] === $tokens[$closingTag]['line'] + ) { $error = 'Closing PHP tag must be on a line by itself'; $fix = $phpcsFile->addFixableError($error, $closingTag, 'ContentAfterEnd'); if ($fix === true) {