Skip to content

Commit 6a3bdda

Browse files
committed
Fix #726 indentation
1 parent a51ff29 commit 6a3bdda

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

lisp/php-mode.el

+2-1
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,7 @@ but only if the setting is enabled."
663663
((looking-at-p "->") '+)
664664
((looking-at-p "[:?]") '+)
665665
((looking-at-p "[,;]") nil)
666+
((looking-at-p "//") nil)
666667
;; Is the previous line terminated with `,' ?
667668
((progn
668669
(forward-line -1)
@@ -672,7 +673,7 @@ but only if the setting is enabled."
672673
(while (and (< beginning-of-langelem (point))
673674
(setq start (php-in-string-or-comment-p)))
674675
(goto-char start)
675-
(skip-chars-backward " ")
676+
(skip-chars-backward " \r\n")
676677
(backward-char 1))
677678
(and (not (eq (point) beginning-of-current-line))
678679
(not (looking-at-p ","))

tests/indent/issue-726.php

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
$a = [
3+
'aaa' => [
4+
'bee' => 2,
5+
],
6+
// 'foo' => [
7+
// 'bar' => 1,
8+
// ],
9+
// ###php-mode-test### ((indent 4))
10+
'lee' => 2,
11+
// 'dee' => 3
12+
'gee' => 4, // ###php-mode-test### ((indent 4))
13+
]; // ###php-mode-test### ((indent 0))

tests/php-mode-test.el

+2-1
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,8 @@ Meant for `php-mode-test-issue-503'."
652652

653653
(ert-deftest php-mode-test-issue-702 ()
654654
"Proper alignment arglist."
655-
(with-php-mode-test ("indent/issue-702.php" :indent t :magic t)))
655+
(with-php-mode-test ("indent/issue-702.php" :indent t :magic t))
656+
(with-php-mode-test ("indent/issue-726.php" :indent t :magic t)))
656657

657658
(ert-deftest php-mode-test-php74 ()
658659
"Test highlighting language constructs added in PHP 7.4."

0 commit comments

Comments
 (0)