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 183807 - Extract method
Summary: Extract method
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.1
Hardware: All All
: P3 normal with 67 votes (vote)
Assignee: Ondrej Brejla
URL:
Keywords: PLAN
Depends on:
Blocks:
 
Reported: 2010-04-09 20:03 UTC by alexey_vasilyev
Modified: 2019-02-04 06:44 UTC (History)
7 users (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 alexey_vasilyev 2010-04-09 20:03:56 UTC
I need a new refactoring feature for PHP IDE:  "Extract method"

Use case:

1. User having a some code in method/function and would like to extract some common functionality to new method. 
2. User selects some lines which must be extracted, and call "extract method" feature. 
3. IDE asks  method name from user and confirm new method parameters
4. User confirms all.
5. IDE extracts code to new method.


Similar functionality implemented in ReSharper for C# (MSVS), but I would like having same in NetBeans for PHP.
Comment 1 Filip Zamboj 2010-09-15 12:31:16 UTC
batch reassigning
Comment 2 martinvium 2010-12-14 10:27:16 UTC
The "Introduce Method" refactoring already available in Netbeans for Java is pretty much perfect for me:

http://azizlp.blogspot.com/2007/08/netbeans-refactor-part-1.html
Comment 3 cgalive 2011-09-29 18:35:28 UTC
It would be really nice to have actual code refactoring features for php in an open source IDE.
Comment 4 patkoscsaba 2012-06-06 19:46:31 UTC
Any news an this one? When I saw that it was marked "target milestone = next" back in April, I thought it will be in 7.2. Still I can't find any new PHP refactoring in the nightly build.
Comment 5 stfalcon 2012-08-27 15:08:42 UTC
there anybody? it's a very important feature for IDE
Comment 6 Ondrej Brejla 2012-08-27 15:10:47 UTC
I plan to implement some new refactorings, but it's no time for 7.3. So probably it will be in some of later releases.
Comment 7 dextervip 2012-09-10 23:12:16 UTC
+1
It's a must have feature!
Comment 8 songoko20000 2012-10-09 11:43:59 UTC
This feature is really important and highly demanded. Please implement it soon.
Comment 9 messaged 2013-08-21 13:15:20 UTC
+1 Missing that feature
Comment 10 patkoscsaba 2013-10-20 11:52:15 UTC
Any progress on this one? It's been 3 and a half years since it was reported...
Comment 11 Nowaker 2013-10-20 11:55:27 UTC
Just go use PhpStorm... You will die waiting with this pace of development.
Comment 12 messaged 2013-10-20 11:56:14 UTC
And that feature is already implemented for Java files...
Comment 13 rjmunro 2014-01-03 16:24:10 UTC
It might be easiest for Netbeans to act as a front end to this project:
https://github.com/QafooLabs/php-refactoring-browser

which impliments some refactoring features on the command line.
Comment 14 Rayhan-Muktader 2014-01-23 15:06:42 UTC
+1  
This is a must have feature for modern PHP coding.
NetBeans is adding support for many modern PHP frameworks to attract users. It will need to add features like these to actually retain those users.
Comment 15 sandreas 2014-05-09 13:46:58 UTC
+1
Please go for it!
Comment 16 artem56 2014-06-10 17:44:07 UTC
+1
Comment 17 VaclavSir 2014-06-11 07:10:53 UTC
Don't write those "+1" comments, use the vote link next to the priority. +1 comments have no relevance. Or just go download PhpStorm, as has been said...
Comment 18 sandreas 2014-06-11 08:05:51 UTC
@VaclavSir: ok, did it, thx. 

P.S.: Kind of odd to recommend PHPStorm twice in this Bug...
Comment 19 lukasz.gawron 2014-11-30 10:10:31 UTC
What is status of this? I have 8.0.1 but still PHP refactoring is very poor. In 8.0.2 changelog nothing about PHP refactoring is mentioned.
Comment 20 Igorock 2014-12-29 20:25:11 UTC
+1
Comment 21 michaelleb 2015-02-23 14:36:37 UTC
For all people that need "extract method" feature. NetBeans has other awesome feature that you can use instead :

php templates with parameter hint.

you can easily surround selected code with function template declaration and even 
add your custom templates.
If you are not familiar with this feature, I strongly recommend to read about it here:

1.https://netbeans.org/kb/docs/php/code-templates.html?print=yes#surround-code

2.https://netbeans.org/kb/docs/php/code-templates.html?print=yes#z-action

Try it NOW (works in NB > 7.3):
1.select the code you want to extract.
2.press alt+enter, select "Surround with public function" from hint dialog menu.

Happy coding!
Comment 22 Smolarium 2016-10-06 08:50:47 UTC
PhpStorm has it. Why not NetBeans?
This is most usefull feature ever. Please make it :)
Comment 23 Nowaker 2016-10-06 09:06:49 UTC
> Nowaker 2013-10-20 11:55:27 UTC
> Just go use PhpStorm... You will die waiting with this pace of development.

Told you!
Comment 24 calyja 2017-02-28 07:37:19 UTC
(In reply to michaelleb from comment #21)
> For all people that need "extract method" feature. NetBeans has other
> awesome feature that you can use instead :
> 
> php templates with parameter hint.
> 
> you can easily surround selected code with function template declaration and
> even 
> add your custom templates.
> If you are not familiar with this feature, I strongly recommend to read
> about it here:
> 
> 1.https://netbeans.org/kb/docs/php/code-templates.html?print=yes#surround-
> code
> 
> 2.https://netbeans.org/kb/docs/php/code-templates.html?print=yes#z-action
> 
> Try it NOW (works in NB > 7.3):
> 1.select the code you want to extract.
> 2.press alt+enter, select "Surround with public function" from hint dialog
> menu.
> 
> Happy coding!

thank You for this advice! I would prefer extraction, but still - better than nothing :)
Comment 25 Carolinewebb 2019-02-01 11:24:03 UTC
Nicely you explained here all the detail regarding Extract method. Anyone can easily understand it and implement it specially IT learners. 

Caroline,
Professional personal statement writer, who design marketing personal statement - http://www.personalstatementfolks.co.uk/marketing-personal-statement/ using UCAS guidelines at Personal Statement Folks in UK.
Comment 26 JackPonting 2019-02-04 06:44:28 UTC
Netbeans is open source which is quickly and simply develop desktop, mobile, and web applications with Java, JavaScript, HTML5, PHP, C/C++ and more. Amazed to knowing about it and also forward details of Netbeans with more people at Quality Dissertation. 

Jack,
At Quality Dissertation, happily assist UK students by providing nursing assignment help - http://www.qualitydissertation.co.uk/nursing-assignment-help with pass guarantee.