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)))
}
|