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.
Created attachment 159298 [details] patch I just attach a patch now. I'll add a comment later. Thanks.
- I added some options(brace placement, paren) (see [1]). - I didn't add indent tokens if anonymous classes are used in the ReturnStatement and Assignment nodes. // no indent tokens $instance = new class { public function test() { } }); // indent tokens are added $instance = new class { public function test() { } }); - In case of Function/MethodInvocation, perhaps, they should be added if the wrapping option for Method Call is "Always". // no indent tokens test(new class { public function test() { } }, $a, $b); // indent tokens are added test(new class { public function test() { } }, $a, $b); - When "0" is set to the Before Class End option(Blank Lines), it may not be available in normal classes (related to the issue 255313). I fixed it only if anonymous classes are used. - We cannot format like the following if multiple interfaces are used and the wrapping option is enabled: // expected $instance = new class extends Foo implements Interface1, Interface2 { }; // actual $instance = new class extends Foo implements Interface1, Interface2 { }; or $instance = new class extends Foo implements Interface1, Interface2 { }; So, it should be fixed. [1] https://github.com/php-fig/fig-standards/blob/master/proposed/extended-coding-style-guide.md#8-anonymous-classes Thanks.
Tomas, Could you please review it when you can make time? Thanks.
Will do it ASAP. Thanks a lot, Junichi!
(In reply to junichi11 from comment #1) > // no indent tokens > $instance = new class { > public function test() { > } > }); I prefer this case. > // indent tokens are added > test(new class { > public function test() { > } > }, > $a, > $b); I prefer this case. > // actual > $instance = new class extends Foo implements Interface1, > Interface2 > { > > }; This case is totally OK for me. Junichi, great job as always! Thank you a lot, really!
Patch applied, thanks a lot for it, Junichi! http://hg.netbeans.org/web-main/rev/9b24600eb951
Integrated into 'main-silver', will be available in build *201604200001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/9b24600eb951 User: Tomas Mysik <tmysik@netbeans.org> Log: #258883 - [PHP7] Formatting for anonymous classes Patch contributed by junichi11@netbeans.org.