This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 254162

Summary: Array Formatting breaks in Anonymous functions with array
Product: php Reporter: ryannaddy
Component: Formatting & IndentationAssignee: Ondrej Brejla <obrejla>
Status: RESOLVED DUPLICATE    
Severity: normal CC: junichi11
Priority: P3    
Version: 8.0.2   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description ryannaddy 2015-08-05 22:15:54 UTC
When You have an array with an anonymous function which contains an array the formatting gets all messed up.

Take this:

<pre>
class MyObject{

    public function func(){
        [
            'func' => function(){
                $array = [];
            }
        ];
    }

}
</pre>

When formatted, it looks like this:

<pre>
class MyObject{

    public function func(){
        [
            'func' => function(){
                $array = [];
            }
                ];
            }

        }
</pre>
Comment 1 ryannaddy 2015-08-05 22:20:13 UTC
Sorry I added <pre> tags, as I didn't know it formatted it already.

If you comment out

$array = [];

Then formatting works fine. This also applies to array() as well not just the short hand.
Comment 2 junichi11 2016-03-30 13:19:46 UTC

*** This bug has been marked as a duplicate of bug 247047 ***