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.
Maybe this should be ENHANCEMENT, but seems to me as a bug now. Steps to reproduce: 1. Define some class in php fileA, then in include fileA in fileB 2. Use the class from fileA in fileB 3. Safely remove the class defined in fileA => fileB is removed even hough it contained other code Product Version: NetBeans IDE Dev (Build 201103210400) Java: 1.6.0_24; Java HotSpot(TM) Client VM 19.1-b02 System: Windows XP version 5.1 running on x86; Cp1250; cs_CZ (nb)
It doesn't work just in Win XP? Because it seems that it works for me in Ubuntu.
I'll try Ubuntu probably on Monday
What happens in ubuntu: 1. Define some class in php fileA and function outside the class, then include fileA in fileB 2. Use the class from fileA in fileB 3. Safely remove the class defined in fileA => fileA is removed, code in fileB remains (even the usage of removed class) I tried to rename the class the same way I had tried to remove it and renaming works. In Ubuntu, after selecting Refactor|Safely delete (right click on class name, for instance "class Foo{"), dialog is opened saying: "Search for usage and safely delete fileA.php". Is it possible that it really deletes only the file, not the class? fileA: class Foo { var $bar = 2; } $foobar = new Foo(); echo "Echo " . $foobar->bar . " bars"; function mm(){} fileB: include 'newEmptyPHP.php'; $foobar = new Foo(); echo "Echo " . $foobar->bar . " bars"; function mmw(){} Product Version: NetBeans IDE Dev (Build 201103280400) Java: 1.6.0_24; Java HotSpot(TM) Client VM 19.1-b02 System: Linux version 2.6.32-24-generic running on i386; UTF-8; en_US (nb)
The same happens on windows xp, I'll try to find the original project from first comment and see what is different.
If I try your use case and try to safely delete the Foo class, it writes me "Search for usages and delete fileA.php" (because it really removes whole file, you can invoke that delete dialog everywhere in the file). So it seems that it only "check for usages"...it doesn't remove references from another files. Then I click on "Refactor" button and my assumption was right I think. There is list of warnings, where is said that "References to elements in selected file were found. Remove all references to these elements in order to safely delete your file.". It saids YOU to remove all references. So you could click on "Show usages..." button and according to shown usages "Remove all references to deleted file - manually". Then in the "Usages" window you can rerun your "Safely Delete" action...and if you have removed all usages, then no warning is detected and "Safely Remove" action is processed without any interruptions. So: "Safely Delete" action only means, that "before removing whole file" is invoked "Find Usages" action to INFORM you, that there are some reference usages...so that YOU should remove them. So it seems like that it's feature and everything works properly for me...or are there just another issues? Or am I wrong with my explanation? Thanks.
You are right, I completely misunderstood this refactoring. Thank you for explaining. As soon as I get to the original project I'll try it again to see if I used it also incorrectly. So for now I change the bug to INVALID