Skip to content

Commit a399e6a

Browse files
authored
Merge pull request #732 from emacs-php/fix/issue-726
Fix #726 indentation
2 parents a51ff29 + 31220ab commit a399e6a

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

CHANGELOG.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,23 @@ All notable changes of the PHP Mode 1.19.1 release series are documented in this
66

77
### Added
88

9-
* **Net feature**: `php-format` ([#730])
9+
* **Net feature**: `php-format` ([#731])
1010
* Add `php-format-project` and `php-format-this-buffer-file` commands
1111
* Add `php-format-auto-mode` minor mode
1212

13+
### Fixed
14+
15+
* Fix array indentation broken by commenting out ([#726], [#732])
16+
1317
### Removed
1418

1519
* No longer highlights `'link` in PHPDoc ([#724])
1620
* Please use `goto-address-prog-mode` minor mode
1721

1822
[#724]: https://github.com/emacs-php/php-mode/pull/724
19-
[#730]: https://github.com/emacs-php/php-mode/pull/730
23+
[#726]: https://github.com/emacs-php/php-mode/pull/726
24+
[#731]: https://github.com/emacs-php/php-mode/pull/731
25+
[#732]: https://github.com/emacs-php/php-mode/pull/732
2026

2127
## [1.24.2] - 2022-11-13
2228

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)