1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-24 15:52:15 +01:00
Files
archived-doc-en/reference/spl/iteratoriterator/valid.xml
Andrew Lyons 8230e70922 Clarify usage of Iterator::valid methods (#3292)
This commit updates the documentation for the `valid` method of the
following iterators:

- `EmptyIterator` - add a note that this will always return false
- `FilterIterator` - add a note that the value will be false until the
  pointer is advanced to the first valid element
- `IteratorIterator` - clarify that the method checks if the element is
  valid.

These now match the source.

I have checked other iterators and these seem to be correctly
documented.

It's worth noting that the `ArrayIterator::valid` method behaves
differently - it checks if the next element is valid (confirmed in
source).

The `DirectoryIterator::valid` method may also be incorrectly
documented but I am not 100% sure of this. The documentation states
that the method checks if it is a valid _file_, but I believe that the
method checks if the Iterator element is valid.
2024-03-28 22:57:53 +01:00

63 lines
1.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="iteratoriterator.valid" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>IteratorIterator::valid</refname>
<refpurpose>Checks if the current element is valid</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="IteratorIterator">
<modifier>public</modifier> <type>bool</type><methodname>IteratorIterator::valid</methodname>
<void/>
</methodsynopsis>
<para>
Checks whether the current element is valid.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; if the current element is valid, otherwise &false;
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>iterator_count</function></member>
<member><methodname>IteratorIterator::current</methodname></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->