Skip to content


Subversion checkout URL

You can clone with
Download ZIP
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...
1 parent e498257 commit 6d2f208c3dd39493f4d45ea67c55a1b7fe06626a @dotdash dotdash committed with gitster
Showing with 3 additions and 1 deletion.
  1. +3 −1 userdiff.c
4 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.
Something went wrong with that request. Please try again.