0

I have a ton of lines of PHP. Many methods contain docblocks that are actually inherited from the method they override.

Example:

MyBaseClass {

    /**
     * @param string $first - first name
     * @param string $last  - last name
     */    
    protected function MyMethod($first, $last) 
    {

    }


    /**
     * @return bool
     */    
    public function MyMethod2($first, $last) 
    {

    }

}

MyChildClass extends MyBaseClass {

    /**
     * @param string $first - first name
     * @param string $last  - last name
     */    
    protected function MyMethod($first, $last) 
    {

    }


    /**
     * @return bool
     */    
    public function MyMethod2($first, $last) 
    {

    }

}

Basically, I would like the docblocks in the child class to read:

/**
 * @inheritDoc
 */

Because as I understand it this is best practice. If this is best practice, can someone recommend me what program / trick / code I can use to change all these inherited docs into the basic one above?

1 Answers1

1

PhpStorm should be able to do this -- so there should should be a checkbox to enable inserting inheritDoc if you extend the methods using PhpStorm's override/extend method UI. There are also extra plugins to tweak that behaviour, e.g. this one.

guessimtoolate
  • 8,372
  • 2
  • 18
  • 26