Edit report at http://pear.php.net/bugs/bug.php?id=12199&edit=1
ID: 12199
Comment by: dsas
Reported By: dean at deansas dot org
Summary: specify return type for arrays
Status: Open
Type: Feature/Change Request
Package: PhpDocumentor
Package Version: 1.4.0
PHP Version: 5.2.4
New Comment:
There are a few different patterns in use in the wild.
The PHPStorm IDE uses Foo[] where Foo is the type.
PHPLint uses array[Bar]Foo where Bar is the array key type and Foo is
the array value type.
Previous Comments:
------------------------------------------------------------------------
[2008-05-14 14:02:35] steplg
I think it would be very helpfull to specify several ways to specify
return value. I really need, for example, this ways:
* Array(MyClass)
* Array( SOME_CONSTANT => MyClass )
* Array( SOME_CONSTANT => Array(SOME_CONST1 => MyClass1 ,
SOME_CONSTANT2 => MyClass2 ) )
The last 2 ways are very usefull if you use assotiative arrays as a
return values.
If it's possible i could do this features by myself, but i don't really
know how and where change source code. Please contact me (StepLg [@]
GMail.com without []) about this question.
------------------------------------------------------------------------
[2008-04-11 12:22:41] ashnazg
An option mentioned on the Sourceforge forums [1] is to use the
"generics" syntax:
@return array<MyClass> array of MyClass objects
[1] - https://sourceforge.net/forum/message.php?msg_id=4889244
------------------------------------------------------------------------
[2007-10-08 08:54:05] cweiske
Description:
------------
it would be helpful if @return would allow specifying the type of array
values, e.g.
@return array(MyClass) Array of MyClass objects
------------------------------------------------------------------------