11

How can i "auto implement"/generate methods from interfaces into PHP classes? I wanna use VS Code for it

interface :

interface MyInterface{  public function myMethod($param); }

class :

Class MyClass implements MyInterface{
//myMethod should be auto generate by vscode
   public function myMethod($param){

}
}

does this feature exist in VS Code?

Spears
  • 2,102
  • 1
  • 17
  • 27
Amibel
  • 149
  • 1
  • 1
  • 7

3 Answers3

4

VSCode doesn't support this out of the box for PHP. For what I know, this is not available through any of the existing PHP plugins like PHP Intelephense or PHP IntelliSense. PHP Intelephense does autocomplete methods from implemented interfaces though.

edit 25-08-2021

Intelephense premium has such feature, you need to buy a very inexpensive license at https://intelephense.com/

Daan Geurts
  • 431
  • 3
  • 19
3

Check PHP tools extension: DEVSENSE.phptools-vscode.

It is providing what you need for free for 30 days as far as I understood.

devope
  • 127
  • 11
2

when you focused the line with cursor,

you could click icon! icon

click icon

byzz
  • 364
  • 1
  • 4
  • 17
  • Which plugin is providing this behavior for you? – wearego Jul 13 '21 at 09:36
  • 2
    @wearego PHP Intelephense https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client does have this feature. You just need to buy license in order to access features. Like $12 – Rafał Łyczkowski Aug 14 '21 at 17:17