Automatically generated getters and setters PHPDoc

Hi guys!

I've set custom setter template to make it return $this for non-static classes. Template looks like this:


/**
* @param ${TYPE_HINT} $${PARAM_NAME}
#if (${STATIC} != "static")
* @return ${CLASS_NAME}
#end
*/
public ${STATIC} function set${NAME}($${PARAM_NAME})
{
#if (${STATIC} == "static")
    self::$${FIELD_NAME} = $${PARAM_NAME};
#else
    $this->${FIELD_NAME} = $${PARAM_NAME};
    return $this;
#end
}



But when I trying to generate setters - I'm getting correctly-generated setter but without PHPDoc. Steps:
1: 1.png

2: 2.png


Do I need to enable something in the settings to make PHPStorm to add PHPDoc?
2 comments
Comment actions Permalink

Hi Dima,

It will work fine if you define type of field with PHPDoc @var:

class Test
{
    /** @var string */
    protected $_param;

...
0

Please sign in to leave a comment.