Skip to content

Commit

Permalink
Fix #726 indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
zonuexe committed Mar 5, 2023
1 parent a51ff29 commit 83b3f48
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lisp/php-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ but only if the setting is enabled."
((looking-at-p "->") '+)
((looking-at-p "[:?]") '+)
((looking-at-p "[,;]") nil)
((looking-at-p "//") nil)
;; Is the previous line terminated with `,' ?
((progn
(forward-line -1)
Expand All @@ -672,7 +673,7 @@ but only if the setting is enabled."
(while (and (< beginning-of-langelem (point))
(setq start (php-in-string-or-comment-p)))
(goto-char start)
(skip-chars-backward " ")
(skip-chars-backward " \r\n")
(backward-char 1))
(and (not (eq (point) beginning-of-current-line))
(not (looking-at-p ","))
Expand Down
13 changes: 13 additions & 0 deletions tests/indent/issue-726.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
$a = [
'aaa' => [
'bee' => 2,
],
// 'foo' => [
// 'bar' => 1,
// ],
// ###php-mode-test### ((indent 4))
'lee' => 2,
// 'dee' => 3
'gee' => 4, // ###php-mode-test### ((indent 4))
]; // ###php-mode-test### ((indent 0))
3 changes: 2 additions & 1 deletion tests/php-mode-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,8 @@ Meant for `php-mode-test-issue-503'."

(ert-deftest php-mode-test-issue-702 ()
"Proper alignment arglist."
(with-php-mode-test ("indent/issue-702.php" :indent t :magic t)))
(with-php-mode-test ("indent/issue-702.php" :indent t :magic t))
(with-php-mode-test ("indent/issue-726.php" :indent t :magic t)))

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

0 comments on commit 83b3f48

Please sign in to comment.