Skip to content

Commit

Permalink
Squiz/EmbeddedPhp: document the behaviour for closed tag block at end…
Browse files Browse the repository at this point in the history
… of file [3]

While the last tag block in a file will **not** be ignored if it is followed by non-empty inline HTML, the "blank lines before the close tag" check _will_ be ignored if this is the last embedded PHP block.

This test documents this behaviour.
  • Loading branch information
jrfnl committed Jan 8, 2024
1 parent 9973c3b commit 37011f6
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Standards/Squiz/Tests/PHP/EmbeddedPhpUnitTest.23.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
// This test case file MUST always start with a long open PHP tag set (with this comment) to prevent
// the tests running into the "first PHP open tag excepted" condition breaking the tests.
// Tests related to that "first PHP open tag excepted" condition should go in separate files.
?>
<!--
The "blank lines before close tag" check will not be executed when this is the last embedded PHP block.

Note: I am not sure what the reason is for this exception, but the sniff has had this behaviour for the longest time,
so this test documents the behaviour without an opinion on the correctness.
-->
<div>
<?php
echo 'There are a few too many blank lines below this line';





?>

</div>
<p>Some more content after the last PHP tag block.</p>

0 comments on commit 37011f6

Please sign in to comment.