Skip to content

Commit

Permalink
Merge pull request #732 from emacs-php/fix/issue-726
Browse files Browse the repository at this point in the history
Fix #726 indentation
  • Loading branch information
zonuexe authored Mar 5, 2023
2 parents a51ff29 + 31220ab commit a399e6a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,23 @@ All notable changes of the PHP Mode 1.19.1 release series are documented in this

### Added

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

### Fixed

* Fix array indentation broken by commenting out ([#726], [#732])

### Removed

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

[#724]: https://github.com/emacs-php/php-mode/pull/724
[#730]: https://github.com/emacs-php/php-mode/pull/730
[#726]: https://github.com/emacs-php/php-mode/pull/726
[#731]: https://github.com/emacs-php/php-mode/pull/731
[#732]: https://github.com/emacs-php/php-mode/pull/732

## [1.24.2] - 2022-11-13

Expand Down
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 a399e6a

Please sign in to comment.