phpdoc variable of class ArrayObject
<p>I have a class that extends <code>ArrayObject</code></p>

<p><code>class Collection extends ArrayObject</code></p>

<p>I know i can define array of objects using this code:</p>

<p><code>/* @var $userArray Model_User[] */</code></p>

<p>But how can i define variable <code>$userArray</code> as an custom array of class <code>Collection</code> that contains objects of class <code>Model_User</code>?</p>

<p>Without changing <code>class Collection</code> or its phpdoc. 
I want to use the same <code>class Collection</code> for different arrays of objects.</p>

<p>This is not the same as <a href="https://stackoverflow.com/questions/778564/phpdoc-type-hinting-for-array-of-objects">PHPDoc type hinting for array of objects?</a>, because in that subject discussion is related to common arrays in php, which are phpdoced as 
<code>/* @var $userArray Model_User[] */</code> in the mean time my question relates to custom build array which if phpdoced my method above will not type hint methods of custom build array class, like so <code>$userArray-&gt;echoChanges()</code> because it will think its a common array, not an array of class Collection. And yes <code>$userArray</code> also acts as an array, so it should type hint array contents <code>$userArray[3]-&gt;name</code>.</p>