Home » Php » Rename namespace in NetBeans PHP?

Rename namespace in NetBeans PHP?

Posted by: admin July 12, 2020 Leave a comment

Questions:

is there a way to easily rename a namespace in NetBeans ide that affects all other namespace declarations?

How to&Answers:

This is a workaround but can help you to change all namespaces declarations inside the project:

  1. Click on the folder that contains all your sources files (e.g. src/ in the root of the project)
  2. Press CTRL+H
  3. Type the namespace or part of the namespace you want to replace (e.g. Foo\Bar) in the search field and target namespace to the ‘replace with’ field (e.g. Foo\MyNewBar)
  4. Click replace
  5. After a while, to the bottom of the screen you will have all places that can be replaced. You can replace all or select only some of them. Be carefull though, all files are saved automatically after the change.