edorian
edorian

Reputation: 38981

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.

Upvotes: 4

Views: 2563

Answers (2)

Devon_C_Miller
Devon_C_Miller

Reputation: 16518

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

Upvotes: 4

Steve Nay
Steve Nay

Reputation: 2829

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.

Upvotes: 3

Related Questions