ZF-8373: Zend_Reflection_Docblock_Tag_Return and _Param do not recognize arrays
Description
It's common (at least to me) to specify arrays in docblocks in either one of two ways:
/**
* @param string[] $bar description
*/
function foo ($bar)
{}
/**
* @param array(string) $bar description
*/
function foo ($bar)
{}
The actual implementation of Zend_Reflection_Docblock_Tag_Return and Zend_Reflection_Docblock_Tag_Param does not recognize these array specifications (but Zend_Server_Reflection does at least the first). Worse, if using one of these array specifications, neither the correct type nor the description are parsed correctly.
In case 1 the reflection would contain: type => "string" description => NULL
In case 2 the reflection would contain: type => "array" description => NULL
The regex used are
@param ^@(\w+)\s+([\w|\\\]+)(?:\s+(\$\S+))?(?:\s+(.*))? @return ^@(\w+)\s+([\w|\\\]+)(?:\s+(.*))?
With the following regexes at least all components will be matched, whereas I don't know if it's sufficient.
@param ^@(\w+)\s+([^\s]+)(?:\s+(\$\S+))?(?:\s+(.*))? @return ^@(\w+)\s+([^\s]+)(?:\s+(.*))?
Comments
Posted by Daniel Kreuer (dkreuer) on 2009-11-23T08:09:28.000+0000
Patch file for described changes
Posted by Ralph Schindler (ralph) on 2011-08-26T17:36:28.000+0000
Fixed in r24405 of release branch 1.11 and in r24404 of trunk