Skip to content

Instantly share code, notes, and snippets.

@cronfy
Forked from lorenzo/remove_closing_tags.sh
Last active February 10, 2017 05:31
Show Gist options
  • Save cronfy/00ffe932f5d59a1b6d5a1babb5dca9f9 to your computer and use it in GitHub Desktop.
Save cronfy/00ffe932f5d59a1b6d5a1babb5dca9f9 to your computer and use it in GitHub Desktop.
Script to remove all closing ?> php tags in a folder
#!/bin/bash
###
echo "Use PHP_CodeSniffer: https://github.com/squizlabs/PHP_CodeSniffer"
echo
echo "Rules:"
echo " * PSR2.Files.ClosingTag"
echo " * PSR2.Files.EndFileNewline"
echo " * Generic.Files.LineEndings"
echo
echo "Example config:"
echo
cat <<XML
<!-- The closing ?> tag MUST be omitted from files containing only PHP. -->
<rule ref="PSR2.Files.ClosingTag"/>
<!-- All PHP files MUST end with a single blank line. -->
<rule ref="PSR2.Files.EndFileNewline"/>
<!-- All PHP files MUST use the Unix LF (linefeed) line ending. -->
<rule ref="Generic.Files.LineEndings">
<properties>
<property name="eolChar" value="\n"/>
</properties>
</rule>
XML
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment