Skip to content

[Documentation] PSR12 - Open Tag #233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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
40 changes: 40 additions & 0 deletions src/Standards/PSR12/Docs/Files/OpenTagStandard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<documentation title="Open PHP Tag">
<standard>
<![CDATA[
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
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.

]]>
</standard>
<code_comparison>
<code title="Valid: Opening PHP tag on a line by itself.">
<![CDATA[
<em><?php</em>

echo 'hi';
]]>
</code>
<code title="Invalid: Opening PHP tag not on a line by itself.">
<![CDATA[
<?php <em>echo 'hi';</em>
]]>
</code>
</code_comparison>
<code_comparison>
<code title="Valid: Opening PHP tag not on a line by itself, but has markup outside the closing PHP tag.">
<![CDATA[
<?php declare(strict_types=1); ?>
<html>
<body>
<?php
// ... additional PHP code ...
?>
</body>
</html>
]]>
</code>
<code title="Invalid: Opening PHP tag not on a line by itself without any markup in the file.">
<![CDATA[
<?php declare(strict_types=1); ?>
]]>
</code>
</code_comparison>
</documentation>