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.
Hi guys, I don't know if it is a bug or something else; "Extract Method" in php platform, does not work as it should; Every time I try to create a new method from a method of class , I get the error "You can't refact here". In general, Refactoring in PHP projects seems to not work as it should, except for "Rename" functionality Is it possible to fix/enhance php refactoring section? Refactoring, in modern php development ( TEST DRIVEN DEVELOPMENT ), is very important!!
Can you please attach a sample project and provide exact steps to reproduce? Simply reopen this issue, thanks.
Hi, yes it is very simple: This the project structure: $ tree . ├── index.php ├── MyClass.php └── nbproject ├── private │ ├── config.properties │ ├── phpcsmd.xml │ ├── private.properties │ └── private.xml ├── project.properties └── project.xml 2 directories, 8 files My simple class looks like this: class MyClass { public function __construct() { } public function tryToRefactorMe() { //... code here $html = ''; $params = ['name1', 'name2']; foreach ($params as $value) { $html .= $value; } return $html; } } I 'd like to extract a new method from the existing "tryToRefactorMe" method, to get something similar: //... class code here public function tryToRefactorMe() { //... code here $html = $this->newExtractedMethod($params); //... code here return $html; } private function newExtractedMethod($params) { //... code here } //... class code here If I try to surround the part of the code to be refactorized, the submenu does not show the universal know "extract method" refactoring option; I have only have "move", copy", etc and no one of these command works. I know that IDEs who implement refactoring, usually have mode options, such as "Extract Method", etc etc ... thanks in advance!
The cause is simple: "Extract Method" refactoring is currently not supported in PHP support (it is supported perhaps only in Java support). Thanks for reporting.