Re: [PATCH v2] Improve diff pattern for PHP files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Javier Spagnoletti via GitGitGadget" <gitgitgadget@xxxxxxxxx>
writes:

> Subject: Re: [PATCH v2] Improve diff pattern for PHP files

You seem to have read J6t's excellent suggestion well but forgot to
retitle.

> From: Javier Spagnoletti <phansys@xxxxxxxxx>
>
> 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@xxxxxxxxx>
> ...
>  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
>
> diff --git a/t/t4018/php-abstract-method b/t/t4018/php-abstract-method
> new file mode 100644
> index 0000000000..ce215df75a
> --- /dev/null
> +++ b/t/t4018/php-abstract-method
> @@ -0,0 +1,7 @@
> +abstract class Klass
> +{
> +    abstract public function RIGHT(): ?string
> +    {
> +        return 'ChangeMe';
> +    }
> +}
> diff --git a/t/t4018/php-final-method b/t/t4018/php-final-method
> new file mode 100644
> index 0000000000..537fb8ad9a
> --- /dev/null
> +++ b/t/t4018/php-final-method
> @@ -0,0 +1,7 @@
> +class Klass
> +{
> +    final public function RIGHT(): string
> +    {
> +        return 'ChangeMe';
> +    }
> +}
> diff --git a/userdiff.c b/userdiff.c
> index 1df884ef0b..a99d84a7e3 100644
> --- a/userdiff.c
> +++ b/userdiff.c
> @@ -143,7 +143,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_]*"
>
> base-commit: 47ae905ffb98cc4d4fd90083da6bc8dab55d9ecc



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux