list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <>
To: Johannes Sixt <>
Cc: Javier Spagnoletti via GitGitGadget <>,, Javier Spagnoletti <>
Subject: Re: [PATCH] Improve diff pattern for PHP files
Date: Tue, 06 Oct 2020 11:55:14 -0700	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <> (Johannes Sixt's message of "Tue, 6 Oct 2020 20:27:06 +0200")

Johannes Sixt <> writes:

> Please choose a commit summary line of the form "area: summary", for
> example:
>    userdiff: PHP: catch "abstract" and "final" functions
> Am 06.10.20 um 12:37 schrieb Javier Spagnoletti via GitGitGadget:
>> From: Javier Spagnoletti <>
>> Improve the output diff readability for php files by taking into account some missing function modifiers.
> "Improve" is a noise word and need not be mentioned; a non-improvement
> would not be accepted. Also, wrap long lines to at most 72 characters.
> Perhaps:
>    PHP permits functions to be defined like
>        public final function foo() { }
>        protected abstract function bar() { }
>    but our hunk header pattern does not recognize these decorations.
>    Add "final" and "abstract" to the list of function modifiers.
> I am not a PHP expert, so I cannot tell whether what I have written
> above makes sense.

Me neither, but the new pattern does look like it was written tp
specifically allow these combinations.  Thanks for a good example
log message to guide new developers with.

>>  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).*)$",

It probably does not matter in practice, but I wondered what the
reason for the ordering between final and abstract here (and one
line above) ;-)

>>  	 /* -- */
>>  	 "[a-zA-Z_][a-zA-Z0-9_]*"
> It would be great if you could add test cases to t/4018/ that
> demonstrate how these new keywords are handled.

Yes.  It seems that we saw another userdiff patch with a test
update recently and that may serve as an example, too.

Thanks, both.

  reply	other threads:[~2020-10-06 18:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-06 10:37 Javier Spagnoletti via GitGitGadget
2020-10-06 18:27 ` Johannes Sixt
2020-10-06 18:55   ` Junio C Hamano [this message]
2020-10-07  3:38 ` [PATCH v2] " Javier Spagnoletti via GitGitGadget
2020-10-07  6:12   ` Junio C Hamano
2020-10-07 18:47     ` Junio C Hamano
2020-10-07 18:07   ` [PATCH v3] userdiff: php: Add "final" and "abstract" to the list of function modifiers Javier Spagnoletti via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this inbox:

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).