Skip to content

Commit f2c3f47

Browse files
committed
Squiz/EmbeddedPhp: document the behaviour for closed tag block at end of file [1]
As things are, the last tag block in a file, at the end of a file, will always be ignored if it contains a PHP close tag, even when it would otherwise trigger errors. These tests document this behaviour.
1 parent d6f8958 commit f2c3f47

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
// This test case file MUST always start with a long open PHP tag set (with this comment) to prevent
3+
// the tests running into the "first PHP open tag excepted" condition breaking the tests.
4+
// Tests related to that "first PHP open tag excepted" condition should go in separate files.
5+
?>
6+
<!-- The complete tag block will be ignored when it is the last (closed) tag block in a file, even when it is an empty tag set. -->
7+
<?php
8+
?>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
// This test case file MUST always start with a long open PHP tag set (with this comment) to prevent
3+
// the tests running into the "first PHP open tag excepted" condition breaking the tests.
4+
// Tests related to that "first PHP open tag excepted" condition should go in separate files.
5+
?>
6+
<!-- The complete tag block will be ignored when it is the last (closed) tag block in a file, even when it is an empty tag set. -->
7+
<!-- Note: with short open tags, the empty PHP tag set is a parse error. -->
8+
<?=
9+
?>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
// This test case file MUST always start with a long open PHP tag set (with this comment) to prevent
3+
// the tests running into the "first PHP open tag excepted" condition breaking the tests.
4+
// Tests related to that "first PHP open tag excepted" condition should go in separate files.
5+
?>
6+
<!-- The complete tag block will be ignored when it is the last (closed) tag block in a file, even when it would otherwise trigger errors. -->
7+
<?php
8+
echo 'too much indent and close tag not on own line'; ?>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
// This test case file MUST always start with a long open PHP tag set (with this comment) to prevent
3+
// the tests running into the "first PHP open tag excepted" condition breaking the tests.
4+
// Tests related to that "first PHP open tag excepted" condition should go in separate files.
5+
?>
6+
<!-- The complete tag block will be ignored when it is the last (closed) tag block in a file, even when it would otherwise trigger errors. -->
7+
<?=
8+
'too much indent and close tag not on own line'; ?>

0 commit comments

Comments
 (0)