Automatisation of search & replace
Hi,
I am programming on five similar apps in one project. The code is in parts completely identical except for namespaces. So I often work on Folder A and copy subfolders with the same code into the other folders.
Folder A
Folder B
Folder C
Folder D
Folder E
After copying the similar code into the other apps, I have to rewrite the namespaces by using search & replace like:
Click on Folder B, then search for string "namespaceA" and replace with "namespaceB", then
click on Folder C, then search for string "namespaceA" and replace with "namespaceC", then
click on Folder C, then search for string "namespaceA" and replace with "namespaceD", then
...
Is there a way to automate this?
请先登录再写评论。
If you set up PSR-0/4 roots in your projects, you can use the PHP | Code style | Class path doesn't match project structure inspection to automatically fix the non-matching namespaces.
Thanks for your reply!
Sorry I didn't fully express myself... It's not only php namespaces, but also many "namespaces" / "namings" / "prefixes" in json files, xml files, js files etc.
I don't think there's a way to automate it on the IDE level, then. Writing a script (PHP or Python) that would do that seems the way to go here.