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}
public ${STATIC} function set${NAME}($${PARAM_NAME})
#if (${STATIC} == "static")
    self::$${FIELD_NAME} = $${PARAM_NAME};
    $this->${FIELD_NAME} = $${PARAM_NAME};
    return $this;

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?
Comment actions Permalink

Hi Dima,

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

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


Please sign in to leave a comment.