Skip to content
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

Squiz.PHP.EmbeddedPhp.ContentAfterEnd and DOCTYPE #3747

Open
kkmuffme opened this issue Jan 24, 2023 · 0 comments
Open

Squiz.PHP.EmbeddedPhp.ContentAfterEnd and DOCTYPE #3747

kkmuffme opened this issue Jan 24, 2023 · 0 comments

Comments

@kkmuffme
Copy link

Describe the bug

Code sample

?><!DOCTYPE html>

Custom ruleset

<?xml version="1.0"?>
<ruleset name="My Custom Standard">
  <description>If you are using a custom ruleset, please enter it here.</description>
  <rule ref="Squiz.PHP.EmbeddedPhp.ContentAfterEnd"/>
</ruleset>

To reproduce
Steps to reproduce the behavior:

  1. Create a file called test.php with the code sample above...
  2. Run phpcbf test.php ...
  3. phpcbf created invalid HTML
?>
<!DOCTYPE html>

Expected behavior
There is no space allowed before the DOCTYPE tag - any space before the DOCTYPE will cause browsers to run quirks mode.

Versions (please complete the following information):

  • OS: Centos 8
  • PHP: 7.4
  • PHPCS: master
  • Standard: custom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant