File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -612,6 +612,10 @@ style from Drupal."
612
612
(php-mode)
613
613
(should-not (buffer-modified-p ))))
614
614
615
+ (ert-deftest php-mode-test-issue-310 ()
616
+ " Proper indentation after function with return type."
617
+ (with-php-mode-test (" issue-310.php" :indent t :magic t )))
618
+
615
619
; ;; php-mode-test.el ends here
616
620
617
621
; ; Local Variables:
Original file line number Diff line number Diff line change 93
93
(if (and (= emacs-major-version 24 ) (>= emacs-minor-version 4 ))
94
94
(require 'cl )))
95
95
96
+ ; ; Work around https://github.com/ejmr/php-mode/issues/310.
97
+ ; ;
98
+ ; ; In emacs 24.4 and 24.5, lines after functions with a return type
99
+ ; ; are incorrectly analyzed as member-init-cont.
100
+ ; ;
101
+ ; ; Before emacs 24.4, c member initializers are not supported this
102
+ ; ; way. Starting from emacs 25.1, cc-mode only detects member
103
+ ; ; initializers when the major mode is c++-mode.
104
+ (eval-and-compile
105
+ (if (and (= emacs-major-version 24 ) (or (= emacs-minor-version 4 )
106
+ (= emacs-minor-version 5 )))
107
+ (defun c-back-over-member-initializers ()
108
+ ; ; Override of cc-engine.el, cc-mode in emacs 24.4 and 24.5 are too
109
+ ; ; optimistic in recognizing c member initializers. Since we don't
110
+ ; ; need it in php-mode, just return nil.
111
+ nil )))
112
+
96
113
97
114
; ; Local variables
98
115
;;;### autoload
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ function a () : string {
4
+ return 'world ' ;
5
+ }
6
+ echo 'hello ' ; // ###php-mode-test### ((indent 0))
You can’t perform that action at this time.
0 commit comments