Skip to content

Commit a1781e2

Browse files
authored
Merge pull request #777 from emacs-php/modify-pear-style
Modify over-indentation for PEAR style
2 parents 2a52f97 + c6efeaa commit a1781e2

File tree

5 files changed

+27
-7
lines changed

5 files changed

+27
-7
lines changed

Diff for: CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,23 @@ All notable changes of the PHP Mode 1.19.1 release series are documented in this
1212
### Changed
1313

1414
* Make `php-mode` inherit from `php-base-mode` instead of `c-mode` ([#772])
15+
* Modify indentation of [PEAR Coding Standards] ([#774], [#777])
16+
* No longer overindent it by default, since we don't see any mention in the coding style that it should hang `.`. (refs [#227] and [#229])
17+
* **If you have any feedback on PEAR style, please let us know in [the discussion #776][#776].**
1518

1619
### Removed
1720

1821
* Remove `php-mode-disable-c-mode-hook` custom variable and `php-mode-neutralize-cc-mode-effect` function ([#775])
1922
* `php-mode` no longer inherits `c-mode`, so this variable won't work.
2023

24+
[#227]: https://github.com/emacs-php/php-mode/pull/227
25+
[#229]: https://github.com/emacs-php/php-mode/pull/229
2126
[#772]: https://github.com/emacs-php/php-mode/pull/772
27+
[#774]: https://github.com/emacs-php/php-mode/issues/774
2228
[#775]: https://github.com/emacs-php/php-mode/pull/775
29+
[#776]: https://github.com/emacs-php/php-mode/discussions/776
30+
[#777]: https://github.com/emacs-php/php-mode/pull/777
31+
[PEAR Coding Standards]: https://pear.php.net/manual/en/standards.php
2332

2433
## [1.25.1] - 2023-11-24
2534

Diff for: lisp/php-mode.el

+1-1
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ a backward search limit."
709709
"pear"
710710
'("php"
711711
(c-basic-offset . 4)
712-
(c-offsets-alist . ((case-label . 0)))
712+
(c-offsets-alist . ((case-label . 0) (statement-cont . +)))
713713
(tab-width . 4)
714714
(php-mode-lineup-cascaded-calls . nil)))
715715

Diff for: tests/issue-227.php renamed to tests/indent/issue-227.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88

99
function my_func() {
1010
return "a really long string with = inside " .
11-
"some more text"; // ###php-mode-test### ((indent 49))
11+
"some more text"; // ###php-mode-test### ((indent 8))
1212
}

Diff for: tests/indent/issue-774.php

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
$someObject->someFunction("some", "parameter") // ###php-mode-test### ((indent 0))
4+
->someOtherFunc(23, 42) // ###php-mode-test### ((indent 4))
5+
->andAThirdFunction(); // ###php-mode-test### ((indent 4))
6+
7+
$result = DateTime::createFromFormat('Y-m-d', '2112-09-03') // ###php-mode-test### ((indent 0))
8+
->someFunction(); // ###php-mode-test### ((indent 4))
9+
10+
$pages = $dbOld->createQueryBuilder() // ###php-mode-test### ((indent 0))
11+
->select('*'); // ###php-mode-test### ((indent 4))

Diff for: tests/php-mode-test.el

+5-5
Original file line numberDiff line numberDiff line change
@@ -522,11 +522,6 @@ style from Drupal."
522522
(search-forward "return")
523523
(should (eq (current-indentation) (* 2 c-basic-offset)))))
524524

525-
(ert-deftest php-mode-test-issue-227 ()
526-
"multi-line strings indents "
527-
(custom-set-variables '(php-lineup-cascaded-calls t))
528-
(with-php-mode-test ("issue-227.php" :indent t :style pear :magic t)))
529-
530525
(ert-deftest php-mode-test-issue-237 ()
531526
"Indent chaining method for PSR2."
532527
(with-php-mode-test ("issue-237.php" :indent t :style psr2 :magic t)))
@@ -696,6 +691,11 @@ Meant for `php-mode-test-issue-503'."
696691
(with-php-mode-test ("lang/errorcontrol.php" :faces t))
697692
(with-php-mode-test ("lang/magical-constants/echo.php" :faces t)))
698693

694+
(ert-deftest php-mode-test-pear ()
695+
"Tests for PEAR style."
696+
(with-php-mode-test ("indent/issue-227.php" :indent t :magic t :style pear))
697+
(with-php-mode-test ("indent/issue-774.php" :indent t :magic t :style pear)))
698+
699699
;; For developers: How to make .faces list file.
700700
;;
701701
;; 1. Press `M-x eval-buffer' in this file bufffer.

0 commit comments

Comments
 (0)