From: Javier Spagnoletti <phansys@gmail.com>
PHP allows some function modifiers that are not recognized in our current hunk header pattern
final public function foo() { }
abstract protected function bar() { }Add "final" and "abstract" to the list of function modifiers.
Signed-off-by: Javier Spagnoletti <phansys@gmail.com>
---
Improve diff pattern for PHP files
PHP allows some function modifiers that are not recognized in our
current hunk header pattern
final public function foo() { }
abstract protected function bar() { }
Add "final" and "abstract" to the list of function modifiers. See:
* https://www.php.net/manual/en/language.oop5.abstract.php#example-213;
* https://www.php.net/manual/en/language.oop5.final.php#language.oop5.traits.static.ex1
.
Signed-off-by: Javier Spagnoletti phansys@gmail.com [phansys@gmail.com]Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-864%2Fphansys%2Fuserdiff_php-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-864/phansys/userdiff_php-v2
Pull-Request: https://github.com/git/git/pull/864
Range-diff vs v1:
1: aa65d43a40 ! 1: 4cb59950ff Improve diff pattern for PHP files
@@ Metadata
## Commit message ##
Improve diff pattern for PHP files
- Improve the output diff readability for php files by taking into account some missing function modifiers.
+ PHP allows some function modifiers that are not recognized in our current hunk header pattern
+
+ final public function foo() { }
+ abstract protected function bar() { }
+
+ Add "final" and "abstract" to the list of function modifiers.
Signed-off-by: Javier Spagnoletti <phansys@gmail.com>
+ ## t/t4018/php-abstract-method (new) ##
+@@
++abstract class Klass
++{
++ abstract public function RIGHT(): ?string
++ {
++ return 'ChangeMe';
++ }
++}
+
+ ## t/t4018/php-final-method (new) ##
+@@
++class Klass
++{
++ final public function RIGHT(): string
++ {
++ return 'ChangeMe';
++ }
++}
+
## userdiff.c ##
@@ userdiff.c: PATTERNS("perl",
"|=~|!~" t/t4018/php-abstract-method | 7 +++++++
t/t4018/php-final-method | 7 +++++++
userdiff.c | 2 +-
3 files changed, 15 insertions(+), 1 deletion(-)
create mode 100644 t/t4018/php-abstract-method
create mode 100644 t/t4018/php-final-method