PHP type missing when param is `null`
gerardroche opened this issue · comments
Gerard Roche commented
I almost have a fix for this, it's depdendent on the pull request Fix #286 PHP namespaced params are missing the \
namespace characters #309
Actual
/**
* [function_name description]
* @param [type] $a [description]
* @return [type] [description]
*/
function function_name(array $a = null) {}
Expected
/**
* [function_name description]
* @param array|null $a [description]
* @return [type] [description]
*/
function function_name(array $a = null) {}
The same goes for namespace type hints:
Actual
/**
* [function_name description]
* @param [type] $a [description]
* @return [type] [description]
*/
function function_name(A\NS\ClassName $a = null) {}
Expected
/**
* [function_name description]
* @param A\NS\ClassName|null $a [description]
* @return [type] [description]
*/
function function_name(A\NS\ClassName $a = null) {}
When the type cannot be guessed what to do? e.g. function function_name($a = null) {}
Actual
/**
* [function_name description]
* @param [type] $a [description]
* @return [type] [description]
*/
function function_name($a = null) {}
Expected
/**
* [function_name description]
* @param [type]|null $a [description]
* @return [type] [description]
*/
function function_name($a = null) {}