File tree 3 files changed +31
-1
lines changed
3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -526,4 +526,14 @@ style from Drupal."
526
526
(call-interactively 'indent-for-tab-command )
527
527
(should (= (current-column ) equal-indentation)))))
528
528
529
+ (ert-deftest php-mode-test-issue-184()
530
+ " Test indent-line for statements and heredoc end at beginning of lines"
531
+ (with-php-mode-test (" issue-184.php" )
532
+ (search-forward " html;" )
533
+ (php-cautious-indent-line)
534
+ (should (eq (current-indentation ) 0 ))
535
+ (search-forward " return;" )
536
+ (php-cautious-indent-line)
537
+ (should (eq (current-indentation ) c-basic-offset))))
538
+
529
539
; ;; php-mode-test.el ends here
Original file line number Diff line number Diff line change @@ -829,7 +829,8 @@ example `html-mode'. Known such libraries are:\n\t"
829
829
(move-beginning-of-line nil )
830
830
; ; Don't indent heredoc end mark
831
831
(save-match-data
832
- (unless (looking-at " [a-zA-Z0-9_]+;\n " )
832
+ (unless (and (looking-at " [a-zA-Z0-9_]+;\n " )
833
+ (php-in-string-p))
833
834
(setq doit t )))
834
835
(goto-char here)
835
836
(when doit
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /**
4
+ * GitHub Issue: https://github.com/ejmr/php-mode/issues/184
5
+ *
6
+ * Test indentation of statements at beginning of line.
7
+ *
8
+ * The termination of a heredoc is always fixed bol, but php-mode must
9
+ * detect that not all statements at column 0 are the end of a
10
+ * heredoc.
11
+ */
12
+
13
+ function test () {
14
+ $ html = <<<html
15
+ <a href="#"></a>
16
+ html ;
17
+
18
+ return ;
19
+ }
You can’t perform that action at this time.
0 commit comments