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 - Array Formatting breaks in Anonymous functions with array
Summary: Array Formatting breaks in Anonymous functions with array
Status: RESOLVED DUPLICATE of bug 247047
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 8.0.2
Hardware: All All
: P3 normal with 1 vote (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-05 22:15 UTC by ryannaddy
Modified: 2016-03-30 13:19 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***