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.
Steps: 1. Write the following code 2. Type something 3. Look at the IDE log Reproducible code: <?php class C { public function foo() { return new class () { public function bar() { } }; } } IDE log: Existing fold: [class] E1 <74,151>, desc='{...}', hash=0x3aa82593, [74, 151] {74, 151}; FoldManager: org.netbeans.modules.csl.editor.fold.GsfFoldManager@600a4010 New fold: [class] E1 <74,151>, desc='{...}', hash=0x798b9fa3, [74, 151] {74, 151}; FoldManager: org.netbeans.modules.csl.editor.fold.GsfFoldManager@600a4010 Adding a fold that is identical with another previously added fold from the same FoldManager is not allowed. Existing fold: [function] E1 <110,141>, desc='{...}', hash=0x74ef0d73, [110, 141] {110, 141}; FoldManager: org.netbeans.modules.csl.editor.fold.GsfFoldManager@600a4010 New fold: [function] E1 <110,141>, desc='{...}', hash=0x66453684, [110, 141] {110, 141}; FoldManager: org.netbeans.modules.csl.editor.fold.GsfFoldManager@600a4010 Thanks.
Thanks for the report.
So, the warnings are now fixed but not really sure if properly. The fix just ignores duplicated scopes which is likely incorrect. However, I am not able to find out how the proper fix should be - in lazy scan, we need to scan method bodies for anonymous classes so they appear in the Navigator window. However, method bodies are later fully scanned again (in non-lazy mode) so these anonymous classes appear in scopes (in model) twice. Thanks. http://hg.netbeans.org/web-main/rev/f4e3eceb4eed
Integrated into 'main-silver', will be available in build *201608081727* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/f4e3eceb4eed User: Tomas Mysik <tmysik@netbeans.org> Log: #258713 - [PHP7] Warnings for code foldings are shown when an anonymous class is used Not sure if it is the proper fix but anonymous classes need to be scanned even in lazy mode because of navigator. Therefore they can appear twice in scopes.