2

I have a project which has a class called Match, but it is now a reserved keyword in php8,

So I tried changing it with Matche, but there are just too many files that uses this class,

how do I, in vscode, also update all of its references to Matche ?

jthinam
  • 279
  • 2
  • 7
  • Does this answer your question? [How to change all occurrences of variable name in Visual Studio Code for PHP?](https://stackoverflow.com/questions/37523793/how-to-change-all-occurrences-of-variable-name-in-visual-studio-code-for-php) – matronator Sep 11 '22 at 06:04

1 Answers1

1

Sadly VSCode still doesn't have any built-in feature like this for PHP. Your only option is to use some extension that provides such feature, though there aren't many extensions that can do this and the ones that do have it are paid.

I was looking for something like this too for quite some time and couldn't find anything reliable for so long. Finally today I found what I was looking for in another question (thank you Adi Candra!):

PHP Refactor Tool extension by Son Tung PHAM. Note

Install the PHP Refactor Tool extension and just click on the thing you want to rename and press F2. Type in the new name and voila! It automatically renames all references in all the relevant files and also renames the file itself if renaming a class or another "top-level file construct".


Note: You need to have the PHP Intelephense extension installed for it to work.

matronator
  • 465
  • 6
  • 13