Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit 6d2f208c3dd39493f4d45ea67c55a1b7fe06626a 1 parent e498257
Björn Steinbrink authored May 23, 2010 gitster committed May 27, 2010

Showing 1 changed file with 3 additions and 1 deletion. Show diff stats Hide diff stats

  1. 4  userdiff.c
4  userdiff.c
@@ -44,7 +44,9 @@ PATTERNS("pascal",
44 44
45 45
46 46
-PATTERNS("php", "^[\t ]*((function|class).*)",
+	 "^[\t ]*(((public|protected|private|static)[\t ]+)*function.*)$\n"
+	 "^[\t ]*(class.*)$",
48 50
 	 /* -- */
49 51
50 52

0 notes on commit 6d2f208

Please sign in to comment.
Something went wrong with that request. Please try again.