userdiff: PHP: catch "abstract" and "final" functions
PHP permits functions to be defined like final public function foo() { } abstract protected function bar() { } but our hunk header pattern does not recognize these decorations. Add "final" and "abstract" to the list of function modifiers. Helped-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Javier Spagnoletti <phansys@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
d98273ba77
commit
aff92827b5
7
t/t4018/php-abstract-method
Normal file
7
t/t4018/php-abstract-method
Normal file
@ -0,0 +1,7 @@
|
||||
abstract class Klass
|
||||
{
|
||||
abstract public function RIGHT(): ?string
|
||||
{
|
||||
return 'ChangeMe';
|
||||
}
|
||||
}
|
7
t/t4018/php-final-method
Normal file
7
t/t4018/php-final-method
Normal file
@ -0,0 +1,7 @@
|
||||
class Klass
|
||||
{
|
||||
final public function RIGHT(): string
|
||||
{
|
||||
return 'ChangeMe';
|
||||
}
|
||||
}
|
@ -147,7 +147,7 @@ PATTERNS("perl",
|
||||
"|=~|!~"
|
||||
"|<<|<>|<=>|>>"),
|
||||
PATTERNS("php",
|
||||
"^[\t ]*(((public|protected|private|static)[\t ]+)*function.*)$\n"
|
||||
"^[\t ]*(((public|protected|private|static|abstract|final)[\t ]+)*function.*)$\n"
|
||||
"^[\t ]*((((final|abstract)[\t ]+)?class|interface|trait).*)$",
|
||||
/* -- */
|
||||
"[a-zA-Z_][a-zA-Z0-9_]*"
|
||||
|
Loading…
Reference in New Issue
Block a user