2

I have the latest Emacs and php-mode setup and this code does not get indented correctly

$app->group('/route', function () use ($app) {
    echo 'hello';
});

Instead it looks like this

$app->group('/route', function () use ($app) {
        echo 'hello';
    });

Note both the last line and that it indents the echo with 8 spaces instead of 4.

I've tried M-x php-enable-psr2-coding-style but it still doesn't work.

Scott Weldon
  • 2,695
  • 1
  • 17
  • 31
  • Probably open a bug against `php-mode` rather than asking a question here? – PythonNut May 26 '15 at 03:55
  • Note though that PHP Mode is currently unmaintained. You'll probably not see this bug fixed unless you fix it yourself. –  May 26 '15 at 05:18
  • @lunaryorn Do you have any other suggestion for coding in PHP? – Oskar Persson May 26 '15 at 06:33
  • @Oskar No, I do not write PHP on a regular basis, and if I had to I'd buy PHPStorm. But I doubt that there's any other PHP Mode for Emacs… –  May 26 '15 at 06:48
  • a php-mode fork is under current development, and is available (as php-mode) from melpa: https://github.com/ejmr/php-mode – Michael Paulukonis May 29 '15 at 15:00
  • @MichaelPaulukonis That is the one I'm using. – Oskar Persson May 29 '15 at 15:12
  • I see you've opened an issue, and it's still open. great! (well, not "solved!" great, but "not-a-dead-end" great.) – Michael Paulukonis May 29 '15 at 15:29
  • @MichaelPaulukonis That is the very PHP Mode is spoke of. “Unmaintained” might have been to harsh, but it's maintainer does not actively work on it anymore. From the [README](https://github.com/ejmr/php-mode#status): “PHP Mode is not dead. However, I will no longer be contributing my own features because my time is taken up my game development that I am doing.” –  May 30 '15 at 17:07

1 Answers1

2

Instead of php-mode you can try web-mode. It supports php very well and seemed to indent correctly your example.

Edit: In order to make flycheck parses php, add the following to your web-mode-hook:

(flycheck-mode 1)
(flycheck-add-mode 'php 'web-mode)
Jesse
  • 1,984
  • 11
  • 19