Skip to content

Commit c9ab06d

Browse files
authored
Merge pull request #233 from dingo-d/documentation/PSR12-files-open-tag
[Documentation] PSR12 - Open Tag
2 parents f8e0b67 + 91c0d4b commit c9ab06d

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<documentation title="Open PHP Tag">
2+
<standard>
3+
<![CDATA[
4+
When the opening <?php tag is on the first line of the file, it must be on its own line with no other statements unless it is a file containing markup outside of PHP opening and closing tags.
5+
]]>
6+
</standard>
7+
<code_comparison>
8+
<code title="Valid: Opening PHP tag on a line by itself.">
9+
<![CDATA[
10+
<em><?php</em>
11+
12+
echo 'hi';
13+
]]>
14+
</code>
15+
<code title="Invalid: Opening PHP tag not on a line by itself.">
16+
<![CDATA[
17+
<?php <em>echo 'hi';</em>
18+
]]>
19+
</code>
20+
</code_comparison>
21+
<code_comparison>
22+
<code title="Valid: Opening PHP tag not on a line by itself, but has markup outside the closing PHP tag.">
23+
<![CDATA[
24+
<?php declare(strict_types=1); ?>
25+
<html>
26+
<body>
27+
<?php
28+
// ... additional PHP code ...
29+
?>
30+
</body>
31+
</html>
32+
]]>
33+
</code>
34+
<code title="Invalid: Opening PHP tag not on a line by itself without any markup in the file.">
35+
<![CDATA[
36+
<?php declare(strict_types=1); ?>
37+
]]>
38+
</code>
39+
</code_comparison>
40+
</documentation>

0 commit comments

Comments
 (0)