Update .php handling to keep <?php at the top
Looking at https://www.php.net/manual/en/language.basic-syntax.phptags.php there are just too many variations and I'm not convinced the added complexity to support all of them would be worth it here. Thus, support only the case where closing tag "?>" is either omitted or on a separate line. A workaround for all other cases is to add the license header manually. Can always revisit this later.
This commit is contained in:
3
main.go
3
main.go
@@ -222,7 +222,7 @@ func licenseHeader(path string, tmpl *template.Template, data *copyrightData) ([
|
||||
case ".html", ".xml":
|
||||
lic, err = prefix(tmpl, data, "<!--", " ", "-->")
|
||||
case ".php":
|
||||
lic, err = prefix(tmpl, data, "<?php", "// ", "?>")
|
||||
lic, err = prefix(tmpl, data, "", "// ", "")
|
||||
case ".ml", ".mli", ".mll", ".mly":
|
||||
lic, err = prefix(tmpl, data, "(**", " ", "*)")
|
||||
}
|
||||
@@ -242,6 +242,7 @@ var head = []string{
|
||||
"<!doctype", // HTML doctype
|
||||
"# encoding:", // Ruby encoding
|
||||
"# frozen_string_literal:", // Ruby interpreter instruction
|
||||
"<?php", // PHP opening tag
|
||||
}
|
||||
|
||||
func hashBang(b []byte) []byte {
|
||||
|
||||
Reference in New Issue
Block a user