Question

Is there a way to customize php storm's way of generating the docblocks ?

By default, I would like to have unknown type vars considered as strings.

This is the default way of generating docblock (using php storm 4.01)

/**
 * @param $name
 */
private function test($name){

}

And I would like this instead if possible :

/**
 * @param string $name
 */
private function test($name){

}    
Was it helpful?

Solution

No, you cannot provide default type for generated @param.

PhpStorm provides correct type whenever it is possible to detect from function declaration. In your example it is not possible (it can be anything).

And I personally do not see a real reason why it needs to be a string (or any other type) by default. Unknown/missing type tells me that I need to finish editing this PHPDoc block so it reflects the actual/correct parameter type. With default type entered already such check is not possible (what if the type should be some class (e.g. Person) or array instead?)

P.S. Kind of related (at least to the actual subject):

This is the Feature Request ticket for Editable PHPDoc Template (that can define what @tags and in what order should be used): http://youtrack.jetbrains.com/issue/WI-11111

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top