Re: ArrayObject docs
| From: | Hannes Magnusson | Date: | Mon, 06 Apr 2009 12:27:57 +0000 |
| Subject: | Re: ArrayObject docs | ||
| References: | 1 2 3 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969380325@lists.php.net to get a copy of this message | ||
On Mon, Apr 6, 2009 at 14:09, Juliette <juxecl@gmail.com> wrote:
> Thanks for the feedback!
>
> 2009/4/6 Hannes Magnusson <hannes.magnusson@gmail.com>
>> - The ArrayObject->count() example should probably mention count()
>> and an example usage.
>> - Same for the offsetSet()/offsetGet()/.. they should probably
>> contain example of $obj[..] = ..; too
>
> Would a 'See Also' reference to count() and
> ArrayAccess::offsetSet()/ArrayAccess::offsetGet() etc do? Just feels wrong
> to be documenting the same functionality in two places.
Haha. I had this massive Deja vu feeling while I wrote this but
couldn't find out why.
Yeah, you are right. Since its already documented a seealso is a good
with, and no example needed.
>> - iterator_to_array():
>> -
>>
>> <methodparam><type>Traversable</type><parameter>iterator</parameter></methodparam>
>> +
>>
>> <methodparam><type>Object</type><parameter>iterator</parameter></methodpar
>> I don't think this change is correct, the object needs to implement
>> Traversable.
>
> Hmm, I disagree :)
> Traversable cannot be used in PHP code. It only has meaning in the C code..
> In userland PHP the top level (parent) classes are Iterator and
> IteratorAggregate.
> To me, it feels wrong to be telling people to implement Traversable when
> that's not possible.
> That's just my opinion though and I'm new here, it's your call. :) The
> Traversable interface is also documented so I guess there's a case for
> leaving it as Traversable.
I think _because_ Traversable is documented (and this explained there)
the proto should be Traversable, especially since this function
doesn't take any object - it has to be iteratable.
> I did intend to expand the parameter description to match iterator_count()
> though, looks like I missed that. (see below)
> <term><parameter>iterator</parameter></term>
> <listitem>
> <para>
> - The iterator being counted.
> + The iterator being copied.
> + The iterator must either implement or inherit from a class implementing
> the
> + <classname>Iterator</classname> or
> <classname>IteratorAggregate</classname> interface.
> </para>
> </listitem>
>
> Is the change from Traversable ok with you when I include this expanded
> description, or do you still prefer to see Traversable as the passed
> parameter?
I don't think the 'enhanced' description is needed as its already
covered in the Traversable docs (just like count(), $arrayobj[].. is
covered elsewhere..) :)
If you think the Traversable docs need better wording we should fix
that instead.
-Hannes