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 268130

Summary: Editor marked unused a method what is called from array_map
Product: php Reporter: lolka_bolka
Component: EditorAssignee: Tomas Mysik <tmysik>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: Dev   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Screenshot about problem

Description lolka_bolka 2016-09-21 09:45:42 UTC
Created attachment 162151 [details]
Screenshot about problem

I know, it could be hard to parse this, but I think this is a legal issue.

When you are calling a method in regular way, like $this->doSomething(); the everything is fine, Netbeanse recoginez that I am using that method.

But when I call it like this array_map([$this, 'doSomething'], ...); it is not.

It is true also for array_walk, and call_user_func.

Is it possible to fix it?
Comment 1 Tomas Mysik 2016-09-21 10:53:31 UTC
Definitely not a P2 so lowering.

Thanks for reporting.
Comment 2 lolka_bolka 2016-09-21 10:57:02 UTC
(In reply to Tomas Mysik from comment #1)
> Definitely not a P2 so lowering.
> 
> Thanks for reporting.

Oh, sorry, I thought lower numbers are lower priority. Now I know this.

My idea is check where the parameter has the callback, check is it an array or a string, if string, check, is there a `::` in it, then that is a static method, if it is an array, then 2nd item is the method.

I forgot array_filter, I don't know is there any more php function what uses callback.
Comment 3 Tomas Mysik 2016-09-21 11:07:23 UTC
(In reply to lolka_bolka from comment #2)
> Oh, sorry, I thought lower numbers are lower priority. Now I know this.

No problem, of course :)

Thanks.