Skip to content

Commit 50e87f8

Browse files
committed
Fix indentation for anonymous class
1 parent 6ed1eea commit 50e87f8

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

php-mode.el

+1
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,7 @@ but only if the setting is enabled"
688688
(case-label . +)
689689
(class-open . 0)
690690
(comment-intro . 0)
691+
(inexpr-class . 0)
691692
(inlambda . 0)
692693
(inline-open . 0)
693694
(namespace-open . 0)

tests/lang/class/anonymous-class.php

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
$class = new class () extends IteratorAggregate {
4+
// ###php-mode-test### ((indent 4))
5+
};
6+
7+
is_object(1, new class () extends IteratorAggregate {
8+
// ###php-mode-test### ((indent 4))
9+
});
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
;; -*- mode: emacs-lisp -*-
2+
(("<?php" . php-php-tag)
3+
("\n\n")
4+
("$" . php-variable-sigil)
5+
("class" . php-variable-name)
6+
(" ")
7+
("=" . php-assignment-op)
8+
(" ")
9+
("new" . php-keyword)
10+
(" ")
11+
("class" . php-keyword)
12+
(" () ")
13+
("extends" . php-keyword)
14+
(" ")
15+
("IteratorAggregate" . font-lock-type-face)
16+
(" {\n ")
17+
("// " . font-lock-comment-delimiter-face)
18+
("###php-mode-test### ((indent 4))\n" . font-lock-comment-face)
19+
("};\n\n")
20+
("is_object" . php-function-call)
21+
("(1, ")
22+
("new" . php-keyword)
23+
(" ")
24+
("class" . php-keyword)
25+
(" () ")
26+
("extends" . php-keyword)
27+
(" ")
28+
("IteratorAggregate" . font-lock-type-face)
29+
(" {\n ")
30+
("// " . font-lock-comment-delimiter-face)
31+
("###php-mode-test### ((indent 4))\n" . font-lock-comment-face)
32+
("});\n"))

tests/php-mode-test.el

+1
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,7 @@ Meant for `php-mode-test-issue-503'."
681681
(t t))))
682682
(with-php-mode-test ("doc-comment/return-type.php" :faces t))
683683
(with-php-mode-test ("doc-comment/inheritdoc.php" :faces t))
684+
(with-php-mode-test ("lang/class/anonymous-class.php" :indent t :magic t :faces t))
684685
(with-php-mode-test ("lang/function/calls.php" :faces t))
685686
(with-php-mode-test ("lang/try-cactch/multiple.php" :faces t))
686687
(with-php-mode-test ("lang/types/cast.php" :faces t))

0 commit comments

Comments
 (0)