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 208309 - Improve Find Usages for non-static methods which are used in static calls
Summary: Improve Find Usages for non-static methods which are used in static calls
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.1
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-12 20:31 UTC by lucian0308
Modified: 2016-07-28 08:06 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
This patch adds support of $cl->staticRoutine() and clDef::nonStaticRoutine() to Find Usages and Auto-Highlight on selection with configuration taken from existing one from Options->Auto Complete->PHP (2.19 KB, patch)
2012-05-05 15:37 UTC, vityan666
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description lucian0308 2012-02-12 20:31:36 UTC
find usage of static methods don't return anyting
refactoring don't work for static methods 

if methods don't have keyword "static" in front
Comment 1 Ondrej Brejla 2012-02-13 09:21:25 UTC
I'm not sure that I understand you correctly. Please, provide me a test code where refactoring don't work and reopen this issue, thanks.
Comment 2 Ondrej Brejla 2012-02-13 10:06:09 UTC
I've made some improvements in the trunk, so it could help you.

http://hg.netbeans.org/web-main/rev/21c99e47726b
Comment 3 vityan666 2012-04-25 17:57:44 UTC
From that lucian has wrote he meant the 'Find Usages' is unable to find 'non-static function called statically' routines. I have the some issue in my project.

Simple test code:
<?php
class CTest208309
{
   static function testStaticFunction($param)
   {
      echo('Hey, im the static one');
      self::testAffectedFunction();
   }

   function testAffectedFunction()
   {
      echo('Hey, im the non-static one but can be safely used statically as i'.
           'do\'n depend on "this" and my class');
   }
}

CTest208309::testStaticFunction(null);
CTest208309::testAffectedFunction();

?>

If you gonna try to find usages for testStaticFunction is gonna be fine but if you search for usages of testAffectedFunction you gonna see only one result - the definition of the function itself.

[b]obrejla[/b]
Please see http://netbeans.org/bugzilla/show_bug.cgi?id=172035 there similar problem was fixed for Code Completion(With added options to:Editor->Code Completion->PHP: (1)Also static methods after "->" (2)Also non-static methods after "::").

Can be useful if similar thing and options(better in Per-Project mode) can be added for "Searching" but better to have one place for it(Not in Code completion and other places) but in PHP(Global/Per Project) options in some separate tab.
Comment 4 Ondrej Brejla 2012-04-26 07:31:36 UTC
Yep I understand now. So we can make an enhancement from this issue since it's really not a defect. It could be implemented in some next release.
Comment 5 vityan666 2012-05-05 15:37:14 UTC
Created attachment 119116 [details]
This patch adds support of $cl->staticRoutine() and clDef::nonStaticRoutine() to Find Usages and Auto-Highlight on selection with configuration taken from existing one from Options->Auto Complete->PHP

Attached a patch which ads the respective support of
1) $classObject->someStaticRoutine(...)
2) {className/self/static}::someNonStaticRoutine(...)
to 'Find Usages' and 'Automatic Highlight on Select'.

Support is configurable via already existing options in Options->Code Completion::PHP->
1) Also Static Methods after "->"
2) Also Non-Static Methods after "::".

Please review the attached patch.
I'm a C/C++/Asm/PHP/Shell developer(Not Java) so deep check for regressions need to be performed by some experienced NetBeans dev.
Comment 6 Tomas Mysik 2016-07-28 08:06:03 UTC
Thanks for the patch, its slightly modified version was applied (the code is a bit different now).

Thanks.

http://hg.netbeans.org/web-main/rev/07c87ae35a20