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 237695 - Refactoring does not see names in the same file for refactoring
Summary: Refactoring does not see names in the same file for refactoring
Status: RESOLVED INVALID
Alias: None
Product: php
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.4
Hardware: Macintosh Mac OS X
: P1 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-27 06:39 UTC by pbw
Modified: 2013-10-27 08:38 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Find usages before refactoring (146.80 KB, image/png)
2013-10-27 06:46 UTC, pbw
Details
Screen before executing refactor (221.08 KB, image/png)
2013-10-27 06:46 UTC, pbw
Details
File after refactoring. (95.82 KB, image/png)
2013-10-27 06:46 UTC, pbw
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pbw 2013-10-27 06:39:29 UTC
Product Version = NetBeans IDE 7.4 (Build 201310111528)
Operating System = Mac OS X version 10.8.5 running on x86_64
Java; VM; Vendor = 1.7.0_40
Runtime = Java HotSpot(TM) 64-Bit Server VM 24.0-b56

The same problem affects Find, so it's not surprising that refactoring doesn't see them either.

Will attach screenshots showing a function definition with a single use in the following function.
Refactoring screen does not see the usage, and after refactoring, the usage is unchanged.
Comment 1 pbw 2013-10-27 06:46:37 UTC
Created attachment 141589 [details]
Find usages before refactoring
Comment 2 pbw 2013-10-27 06:46:43 UTC
Created attachment 141590 [details]
Screen before executing refactor
Comment 3 pbw 2013-10-27 06:46:46 UTC
Created attachment 141591 [details]
File after refactoring.
Comment 4 pbw 2013-10-27 06:47:29 UTC
My initial reference to Find should be Find usages.
Comment 5 Ondrej Brejla 2013-10-27 07:57:41 UTC
It works properly. You try to refactor static function which have to be used with self:: static:: ClassName:: prefix. Calling just a method name calls global function.

This fails with fatal error:

<?php
class TstCls {
    public static function staticFoo() {
        return "Wrong";
    }
    public static function staticBar() {
        echo staticFoo();
    }
}
TstCls::staticBar();
?>

This works and refacoring works as well:

<?php
class TstCls {
    public static function staticFoo() {
        return "Wrong";
    }

    public static function staticBar() {
        echo self::staticFoo();
    }
}
TstCls::staticBar();
?>
Comment 6 pbw 2013-10-27 08:38:31 UTC
Thanks for the PHP lesson!