diff --git a/src/Standards/Generic/Sniffs/WhiteSpace/DisallowTabIndentSniff.php b/src/Standards/Generic/Sniffs/WhiteSpace/DisallowTabIndentSniff.php index e230916ca3..ecf19ca53f 100644 --- a/src/Standards/Generic/Sniffs/WhiteSpace/DisallowTabIndentSniff.php +++ b/src/Standards/Generic/Sniffs/WhiteSpace/DisallowTabIndentSniff.php @@ -169,6 +169,14 @@ public function process(File $phpcsFile, $stackPtr) continue; } + // Report, but don't auto-fix tab identation for a PHP 7.3+ flexible heredoc/nowdoc closer. + // Auto-fixing this would cause parse errors as the indentation of the heredoc/nowdoc contents + // needs to use the same type of indentation. Also see: https://3v4l.org/7OF3M . + if ($tokens[$i]['code'] === T_END_HEREDOC || $tokens[$i]['code'] === T_END_NOWDOC) { + $phpcsFile->addError($error, $i, $errorCode.'HeredocCloser'); + continue; + } + $fix = $phpcsFile->addFixableError($error, $i, $errorCode); if ($fix === true) { if (isset($tokens[$i]['orig_content']) === true) { diff --git a/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.3.inc.fixed b/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.3.inc.fixed deleted file mode 100644 index 622088ad29..0000000000 --- a/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.3.inc.fixed +++ /dev/null @@ -1,13 +0,0 @@ -