Browse files

diff: Support visibility modifiers in the PHP hunk header regexp

Starting with PHP5, class methods can have a visibility modifier, which
caused the methods not to be matched by the existing regexp, so extend
the regexp to match those modifiers. And while we're at it, allow the
"static" modifier as well.

Since the "static" modifier can appear either before or after the
visibility modifier, let's just allow any number of modifiers to appear
in any order, as that simplifies the regexp and shouldn't cause any
false positives.

Signed-off-by: Björn Steinbrink <>
Signed-off-by: Junio C Hamano <>
  • Loading branch information...
dotdash authored and gitster committed May 23, 2010
1 parent e498257 commit 6d2f208c3dd39493f4d45ea67c55a1b7fe06626a
Showing with 3 additions and 1 deletion.
  1. +3 −1 userdiff.c
@@ -44,7 +44,9 @@ PATTERNS("pascal",
-PATTERNS("php", "^[\t ]*((function|class).*)",
+ "^[\t ]*(((public|protected|private|static)[\t ]+)*function.*)$\n"
+ "^[\t ]*(class.*)$",
/* -- */

0 comments on commit 6d2f208

Please sign in to comment.