Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public function process(File $phpcsFile, $stackPtr)

$end = $phpcsFile->findEndOfStatement($stackPtr);
for ($i = ($end + 1); $i < ($phpcsFile->numTokens - 1); $i++) {
if ($tokens[$i]['code'] === T_CLOSE_TAG) {
// Don't enforce new line if the next thing after the statement is a PHP close tag.
return;
}

if ($tokens[$i]['line'] === $tokens[$end]['line']) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,10 @@ namespace Vendor\Package;
$call = namespace\function_name();
echo namespace\CONSTANT_NAME;
// Something which is not a blank line.

// When the next thing after a namespace declaration is a PHP close tag, don't enforce a new line as it may impact HTML display.
namespace Vendor\NoBlankLine\EndsOnCloseTag ?>
<?php
namespace Vendor\HasBlankLine\EndsOnSemiColonPlusCloseTag; ?>

<?php
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ namespace Vendor\Package;
$call = namespace\function_name();
echo namespace\CONSTANT_NAME;
// Something which is not a blank line.

// When the next thing after a namespace declaration is a PHP close tag, don't enforce a new line as it may impact HTML display.
namespace Vendor\NoBlankLine\EndsOnCloseTag ?>
<?php
namespace Vendor\HasBlankLine\EndsOnSemiColonPlusCloseTag; ?>

<?php
Loading