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 228240 - Rename refactoring should be able to perform in-place instant rename in file scope.
Summary: Rename refactoring should be able to perform in-place instant rename in file ...
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.3.1
Hardware: All All
: P3 normal with 2 votes (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
: 202886 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-04-04 09:58 UTC by erusev
Modified: 2013-11-04 16:16 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description erusev 2013-04-04 09:58:19 UTC
Rename refactoring should be able to perform in-place instant rename in file scope (and not only method and class scope). There are many occasions where, because of the framework in use or just the project structure, PHP files have a scope of their own and in-place instant rename would be a quicker and more importantly a faultless way to perform rename.
Comment 1 Ondrej Brejla 2013-04-04 10:01:26 UTC
That's not true...you can have a file:

<?php
echo $foo;
echo $foo + " another foo usage";
?>

and if you try to refactor $foo, then instant rename can't be used, because $foo can be declared in some another file...
Comment 2 hkdobrev 2013-04-04 10:14:45 UTC
(In reply to comment #1)
> That's not true...you can have a file:
> 
> <?php
> echo $foo;
> echo $foo + " another foo usage";
> ?>
> 
> and if you try to refactor $foo, then instant rename can't be used, because
> $foo can be declared in some another file...


Short example:

Kohana PHP framework -> views files -> variables in a local scope which seem in a global scope for netbeans.
Comment 3 Ondrej Brejla 2013-04-04 10:16:00 UTC
Ok, so that's Kohana specific issue.
Comment 4 erusev 2013-04-04 10:18:55 UTC
Ondrey Brejla,

This is correct - rename would not be able to perform an instant rename on $foo and in most cases, this would be correct because, as you say, it could be used in another file.

There are, however, cases where, because of the framework in use or just the project structure, it is known that the file has a scope of its own (for example a view file in Kohana PHP). In such cases, instant rename would be extremely helpful.
Comment 5 erusev 2013-04-04 10:25:35 UTC
This is not at all Kohana specific. It is very likely that most PHP frameworks use files that have scopes of their own.
Comment 6 Ondrej Brejla 2013-04-04 10:28:40 UTC
It's definitely framework specific...and it goes against PHP specification...so it has to be handled specificaly for every use case. Can't be handled globally.
Comment 7 erusev 2013-04-04 10:36:20 UTC
How is this framework specific? What about simple apps that use a single PHP files? They use no framework and would still benefit from the feature.

I'm not saying that regular, global scope, refactoring should be removed. It is very helpful and it should definitely remain in the IDE. What I'm saying is that there should be a way to use instant rename in file scope.
Comment 8 Ondrej Brejla 2013-04-04 10:40:26 UTC
> What I'm saying is
that there should be a way to use instant rename in file scope.

And I say, Yes, but just in specific cases. Not globally :)
Comment 9 erusev 2013-04-04 10:46:23 UTC
Also, how does it go against the specification of PHP? Does the specification say that you shouldn't have variables that are not used outside of the file they are defined in?
Comment 10 erusev 2013-04-04 10:49:02 UTC
Yes, that's exactly what I'm saying and of course it makes sense in specific cases only, but even though they are specific, these cases are many enough to make a feature like this worth it. 

I hope you'd agree.
Comment 11 erusev 2013-04-05 09:10:43 UTC
Do you think there is a chance for this feature to find a place in the IDE?
Comment 12 Ondrej Brejla 2013-04-05 09:12:48 UTC
Yes, that's why I'm letting this opened ;) But really don't know when...sry.
Comment 13 dagguh 2013-09-03 14:23:03 UTC
One way of dealing with this is to have an extra action - Instant Refactoring, which would force a single-file refactoring scope. Developers which know that their framework is weird would use the Instant Refactoring instead of the normal one. They could assign their own hotkey, etc.
Comment 14 erusev 2013-09-03 16:00:37 UTC
(In reply to dagguh from comment #13)
> One way of dealing with this is to have an extra action - Instant
> Refactoring, which would force a single-file refactoring scope. Developers
> which know that their framework is weird would use the Instant Refactoring
> instead of the normal one. They could assign their own hotkey, etc.

This sounds like a great solution.
Comment 15 duke 2013-11-04 16:13:19 UTC
It's really useful feature! In view files (usually with .phtml extension) I do annoying refactoring by word replace.

I propose to add two check-boxes to Rename dialog. One for infile rename, another for rename action using all open files in editor.

Such feature will be great to most programmers.
Thanks.
Comment 16 duke 2013-11-04 16:16:30 UTC
*** Bug 202886 has been marked as a duplicate of this bug. ***