git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] userdiff: support enum keyword in PHP hunk header

From
UGUSAMI Kenta via GitGitGadget <gitgitgadget@gmail.com>
Date
Aug 31, 2021, 06:01 UTC
Message-ID
<pull.1082.git.git.1630389685997.gitgitgadget@gmail.com>
From: USAMI Kenta <tadsan@zonu.me>

"enum" keyword will be introduced in PHP 8.1. https://wiki.php.net/rfc/enumerations

Signed-off-by: USAMI Kenta <tadsan@zonu.me>
---
    userdiff: support enum keyword in PHP hunk header
    
    "enum" keyword will be introduced in PHP 8.1.
    https://wiki.php.net/rfc/enumerations
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1082%2Fzonuexe%2Ffeature%2Fuserdiff-php-enum-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1082/zonuexe/feature/userdiff-php-enum-v1
Pull-Request: https://github.com/git/git/pull/1082
 t/t4018/php-enum | 4 ++++
 userdiff.c       | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
 create mode 100644 t/t4018/php-enum
diff --git a/t/t4018/php-enum b/t/t4018/php-enum
new file mode 100644
index 00000000000..91a69c1a2bc
--- /dev/null
+++ b/t/t4018/php-enum
@@ -0,0 +1,4 @@
+enum RIGHT: string
+{
+    case Foo = 'ChangeMe';
+}
diff --git a/userdiff.c b/userdiff.c
index d9b2ba752f0..d9ec484d535 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -214,7 +214,7 @@ PATTERNS("perl",
 	 "|<<|<>|<=>|>>"),
 PATTERNS("php",
 	 "^[\t ]*(((public|protected|private|static|abstract|final)[\t ]+)*function.*)$\n"
-	 "^[\t ]*((((final|abstract)[\t ]+)?class|interface|trait).*)$",
+	 "^[\t ]*((((final|abstract)[\t ]+)?class|enum|interface|trait).*)$",
 	 /* -- */
 	 "[a-zA-Z_][a-zA-Z0-9_]*"
 	 "|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+"

base-commit: c4203212e360b25a1c69467b5a8437d45a373cac
-- 
gitgitgadget
Next: Junio C Hamano
Message 1 of 2 in “userdiff: support enum keyword in PHP hunk header”
  1. userdiff: support enum keyword in PHP hunk headerUSAMI Kenta via GitGitGadget, Aug 31, 2021
  2. Junio C HamanoAug 31, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.