php - How to inherit phpdoc from another method (not the one we are overwriting) -


i wandering if there method copy (inherit) exact same phpdoc on different methods in same and/or different classes.

i know inline {@inheritdoc}, provide inheritance parent child class (as 1 should expect :).

but @ following, there have copy same description in 3 different places, 2 methods in same class , 1 in separate class (not inherited initiated). wondering if there method might trick, without copy pasting.

class example {     /**      * here want have same phpdoc,      * created getmesomethingfromtheshelf() in same class      */     public function getmesomething($id, $option = [])     {         return $this->getmesomethingfromtheshelf($id, $option);     }      /**      * description      * , more detail how $option value used      *      * @param int $id      * @param array $option , here have sample      * @return string      */     public function getmesomethingfromtheshelf($id, $option = [])     {     return 'here go :)';     } }  class anotherclass {     /**      * here want have same phpdoc,      * created example::getmesomethingfromtheshelf() in example class      */     public function fetchsomething($id, $option = [])     {         return (new example)->getmesomething($id, $option = []);     } } 

thanks suggestion, in advance :)

{@inheritdoc} built-in, without support specifying inheritance source. please make use of @see tag.

it unlikely 2 methods should described same way. if proxy, or passes data through, description should note behavior, , @see tag should direct user interfaced method.

i routinely use @see , @link tags link sapi documentation, or resolve proxies. said, try include sort of description well, , document parameters , returns, if identical (helps when looking @ code).

be careful of getting reliant on phpdoc's shortcuts.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -