开发者

Netbeans auto format issue with method parameter indention

I'm trying to figure out if i missed (or misused) a configuration setting.

Using autoformat on this piece of code:

开发者_如何学编程<?php
class foo {

    public function test() {
        $x = $this->foobar(
            1,
            2
        );
    }

}

produces:

<?php

class foo {

    public function test() {
        $x = $this->foobar(
                1,
                2
        );
    }

}

and i'd like netbeans to stop doing that because apart from that the auto formatting works quite well.

It only happens if there is an assignment on the line with the function call.


You are getting 2 continuation indents, one for the assignment and one for the parameter list. If you insert a break between the assignment and $this->foobar it becomes more apparent:

class foo {
    public function test() {
        $x =
            $this->foobar(
                1,
                2
        );
    }
}

So, that's the "why" of it. Unfortunately, NB exposes very few controls for formatting php. There does not appear to be a way to change this behavior.

I'd suggest opening a bug report and keep an eye on the Netbeans PHP blog


Try changing the "Continuation Indentation" option to 4.

Go to Tools > Options > Editor. Then select PHP from the Language drop-down and Tabs And Indents from the Category drop-down. The Continuation Indentation option is near the bottom.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜