From 17d2686040bc9eb9255f103e8573e85225bae920 Mon Sep 17 00:00:00 2001 From: "Matth?us G. Chajdas" Date: Wed, 6 Mar 2019 19:51:32 +0100 Subject: Fix #1482. Add a shebang_match for php. --- pygments/lexers/php.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pygments/lexers/php.py') diff --git a/pygments/lexers/php.py b/pygments/lexers/php.py index f959fb1f..440d9d81 100644 --- a/pygments/lexers/php.py +++ b/pygments/lexers/php.py @@ -15,7 +15,8 @@ from pygments.lexer import RegexLexer, include, bygroups, default, using, \ this, words from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ Number, Punctuation, Other -from pygments.util import get_bool_opt, get_list_opt, iteritems +from pygments.util import get_bool_opt, get_list_opt, iteritems, \ + shebang_matches __all__ = ['ZephirLexer', 'PhpLexer'] @@ -261,6 +262,8 @@ class PhpLexer(RegexLexer): yield index, token, value def analyse_text(text): + if shebang_matches(text, r'php'): + return True rv = 0.0 if re.search(r'<\?(?!xml)', text): rv += 0.3 -- cgit v1.2.1