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

Summary: Refactoring does not see names in the same file for refactoring
Product: php Reporter: pbw <pbw>
Component: RefactoringAssignee: Ondrej Brejla <obrejla>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P1    
Version: 7.4   
Hardware: Macintosh   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:
Attachments: Find usages before refactoring
Screen before executing refactor
File after refactoring.

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!