php-mode icon indicating copy to clipboard operation
php-mode copied to clipboard

Indent callback functions

Open andizzle opened this issue 11 years ago • 2 comments

Not sure if it's a bug, but this leads to inconsistent indentation. These codes will be indented differently:

array_map(function() {
    process();
}, [1, 2, 3])
array_map(function() use ($foo) {
        process();
    }, [1, 2, 3])

When an object function accepts a callback function, the indent is inconsistent as well.

$users->each(function($user) {
    do_something();
});
$users->each(function($user) use ($foo) {
        do_something();
    });

Is there anything I can do to fix this? I'm using the default indent mode.

Thanks!

andizzle avatar Nov 18 '14 01:11 andizzle

Thank you for the information. I will look into to it soon-ish and try to provide you a solution to achieve the desired indentation.

ejmr avatar Nov 28 '14 22:11 ejmr

This is slightly related to #199, which is fixed by 801a2d5 but only in a very dissatisfactory manner. I plan on finding a better solution for this issue and #199 upcoming holidays - if nobody beats me to it of course.

jorissteyn avatar Dec 22 '14 22:12 jorissteyn