php - PHPDoc, Factory @return type -


let's i've

  • an abstract class with 1 abstract method.
  • 2 child classes define abstract method in own way.
  • a factory returns instance of 1 of 2 child classes based on arguments.

following sample code

abstract class datalist{     abstract public function render($arg1, $arg2); }  class datalist_table{     public function render($arg1, $arg2){         /* here */     } }  class datalist_list{     public function render($arg1, $arg2){         /* here */     } }  class datalistfactory{      /**      * usual stuff      *      * @return datalist      */     public static function build($args){         $class_name = 'datalist_' . $args['type'];         return new $class_name($args['m'][0], $args['m'][1]);     } }  //in other file $list = datalistfactory::build($args); $list-> .... 

my problem

my ide (phpstorm) not hint on $list->render(). guess because has been declared abstract.

question
should put in front of @return in phpdoc datalistfactory::build() ide hints on functions defined in child classes well.

p.s.

you need open file in project. use phpstorm 8.0.3 create new file in project , insert code. works fine =)

code completion


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -