PHP Docbloc:将继承的方法更改为标准链接@inheritDoc - 最佳实践?

时间:2018-04-22 22:18:38

标签: php docblocks

我有很多PHP系列。许多方法都包含实际上从它们覆盖的方法继承的docblock。

示例:

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) 
    {

    }

}

基本上,我希望子类中的docblock可以读取:

/**
 * @inheritDoc
 */

因为我理解这是最好的做法。如果这是最佳实践,有人可以推荐我使用哪些程序/技巧/代码将所有这些继承的文档更改为上面的基本文档?

1 个答案:

答案 0 :(得分:1)

PhpStorm应该能够this - 因此,如果使用PhpStorm's override/extend method UI扩展方法,则应该有一个复选框以启用插入inheritDoc。还有额外的插件来调整这种行为,例如: this one

相关问题