Subject: bug#71710: closed (Re: bug#71710: 30.0.50; [PATCH] php-ts-mode: new rule to indent php alternative syntax.)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 22 Jun 2024 09:44:02 +0000

Your bug report

#71710: 30.0.50; [PATCH] php-ts-mode: new rule to indent php alternative syntax.

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
71710: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71710
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#71710: 30.0.50; [PATCH] php-ts-mode: new rule to indent php alternative syntax.
From: Eli Zaretskii <[email-masked]>
To: Vincenzo Pupillo <[email-masked]>
Cc: [email-masked]
Date: Sat, 22 Jun 2024 12:43:16 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Vincenzo Pupillo <[email-masked]>
> Date: Fri, 21 Jun 2024 23:46:15 +0200
> 
> The attached patch fixes the indentation of PHP's 
> "alternative syntax for control structure".
> https://www.php.net/manual/en/control-structures.alternative-syntax.php

Thanks, installed, and closing the bug.

Subject: 30.0.50; [PATCH] php-ts-mode: new rule to indent php alternative syntax.
From: Vincenzo Pupillo <[email-masked]>
To: [email-masked]
Date: Fri, 21 Jun 2024 23:46:15 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi, 
The attached patch fixes the indentation of PHP's 
"alternative syntax for control structure".
https://www.php.net/manual/en/control-structures.alternative-syntax.php

Thanks.
Vincenzo

GNU Emacs 30.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.42, cairo 
version 1.18.0) of 2024-06-21

>From 45f6c668bdf0b88227db8de3576a2c6408966c49 Mon Sep 17 00:00:00 2001
From: Vincenzo Pupillo <[email-masked]>
Date: Fri, 21 Jun 2024 23:24:33 +0200
Subject: [PATCH] Support for indentation of PHP alternative syntax control
 structures

For some control structures, PHP provides an alternative syntax.
A new rule has been added to handle this syntax.

* lisp/progmodes/php-ts-mode.el (php-ts-mode--indent-styles):
  New rule for PHP alternative syntax.
---
 lisp/progmodes/php-ts-mode.el | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el
index 8bb18dab3d5..415ba695158 100644
--- a/lisp/progmodes/php-ts-mode.el
+++ b/lisp/progmodes/php-ts-mode.el
@@ -651,6 +651,12 @@ php-ts-mode--indent-styles
 
            ;; These rules are for cases where the body is bracketless.
            ((match "while" "do_statement") parent-bol 0)
+           ;; rule for PHP alternative syntax
+           ((or (node-is "else_if_clause")
+                (node-is "endif")
+                (node-is "endforeach")
+                (node-is "endwhile"))
+            parent-bol 0)
            ((or (parent-is "if_statement")
                 (parent-is "else_clause")
                 (parent-is "for_statement")
-- 
2.45.2