File: issue-186.php

package info (click to toggle)
php-elisp 1.24.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,220 kB
  • sloc: lisp: 7,069; php: 5,343; makefile: 58; sh: 10
file content (50 lines) | stat: -rw-r--r-- 1,332 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php

/**
 * GitHub Issue:    https://github.com/emacs-php/php-mode/issues/186
 *
 * Test indentation of case body preceeded by multiple case labels
 * that fall through
 *
 * Note that this test uses the PEAR standard where case and switch
 * statements are aligned to the same column, unlike the other styles.
 * This does not matter for the purpose of this test.
 */

switch (true) {
case true:
    echo 'test'; // ###php-mode-test### ((indent (* c-basic-offset 2)))
    echo 'test'; // ###php-mode-test### ((indent (* c-basic-offset 2)))
}

switch (true) {
case null:
case false:
    echo 'test'; // ###php-mode-test### ((indent (* c-basic-offset 2)))
    echo 'test'; // Emacs27 breaks indentation in this case #612
}

switch (true) {
case "test":
case "test":
    echo 'test'; // ###php-mode-test### ((indent (* c-basic-offset 2)))
    echo 'test'; // ###php-mode-test### ((indent (* c-basic-offset 2)))
}

switch (true) {
case $test:
case $test:
    echo 'test'; // ###php-mode-test### ((indent (* c-basic-offset 2)))
    echo 'test'; // ###php-mode-test### ((indent (* c-basic-offset 2)))
}

const AAA = 'AAA';
const bbb = 'bbb';

switch (true) {
case AAA:
case bbb:
case 111:
    echo 'test'; // ###php-mode-test### ((indent (* c-basic-offset 2)))
    echo 'test'; // ###php-mode-test### ((indent (* c-basic-offset 2)))
}