reference/spl/filesystemiterator/construct.xml
a7d00d0b9169ac0ca5e35dbed32ee288f4614586
...
...
@@ -1,6 +1,5 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-

4
3
<refentry xml:id="filesystemiterator.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5
4
<refnamediv>
6
5
<refname>FilesystemIterator::__construct</refname>
...
...
@@ -9,13 +8,13 @@
9
8

10
9
<refsect1 role="description">
11
10
&reftitle.description;
12
-
<methodsynopsis>
11
+
<constructorsynopsis role="FilesystemIterator">
13
12
<modifier>public</modifier> <methodname>FilesystemIterator::__construct</methodname>
14
-
<methodparam><type>string</type><parameter>path</parameter></methodparam>
13
+
<methodparam><type>string</type><parameter>directory</parameter></methodparam>
15
14
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS</initializer></methodparam>
16
-
</methodsynopsis>
15
+
</constructorsynopsis>
17
16
<para>
18
-
Constructs a new filesystem iterator from the <parameter>path</parameter>.
17
+
Constructs a new filesystem iterator from the <parameter>directory</parameter>.
19
18
</para>
20
19

21
20
</refsect1>
...
...
@@ -25,7 +24,7 @@
25
24
<para>
26
25
<variablelist>
27
26
<varlistentry>
28
-
<term><parameter>path</parameter></term>
27
+
<term><parameter>directory</parameter></term>
29
28
<listitem>
30
29
<para>
31
30
The path of the filesystem item to be iterated over.
...
...
@@ -46,18 +45,48 @@
46
45
</para>
47
46
</refsect1>
48
47

49
-
<refsect1 role="returnvalues">
50
-
&reftitle.returnvalues;
48
+
<refsect1 role="errors">
49
+
&reftitle.errors;
51
50
<para>
52
-
&return.void;
51
+
Throws an <classname>UnexpectedValueException</classname>
52
+
if the <parameter>directory</parameter> does not exist.
53
+
</para>
54
+
<para>
55
+
Throws a <classname>ValueError</classname>
56
+
if the <parameter>directory</parameter> is an empty string.
53
57
</para>
54
58
</refsect1>
55
59

56
-
<refsect1 role="errors">
57
-
&reftitle.errors;
60
+
<refsect1 role="changelog">
61
+
&reftitle.changelog;
58
62
<para>
59
-
Throws an <classname>UnexpectedValueException</classname>
60
-
if the <parameter>path</parameter> cannot be found.
63
+
<informaltable>
64
+
<tgroup cols="2">
65
+
<thead>
66
+
<row>
67
+
<entry>&Version;</entry>
68
+
<entry>&Description;</entry>
69
+
</row>
70
+
</thead>
71
+
<tbody>
72
+
<row>
73
+
<entry>8.2.0</entry>
74
+
<entry>
75
+
Prior to PHP 8.2.0, <constant>FilesystemIterator::SKIP_DOTS</constant> was
76
+
always set and could not be removed.
77
+
</entry>
78
+
</row>
79
+
<row>
80
+
<entry>8.0.0</entry>
81
+
<entry>
82
+
Now throws a <classname>ValueError</classname> if
83
+
<parameter>directory</parameter> is an empty string;
84
+
previously it threw a <classname>RuntimeException</classname>.
85
+
</entry>
86
+
</row>
87
+
</tbody>
88
+
</tgroup>
89
+
</informaltable>
61
90
</para>
62
91
</refsect1>
63
92

...
...
@@ -69,14 +98,24 @@
69
98
<programlisting role="php">
70
99
<![CDATA[
71
100
<?php
72
-
$it = new FilesystemIterator(dirname(__FILE__));
101
+
$it = new FilesystemIterator(dirname(__FILE__), FilesystemIterator::CURRENT_AS_FILEINFO);
73
102
foreach ($it as $fileinfo) {
74
103
echo $fileinfo->getFilename() . "\n";
75
104
}
76
105
?>
77
106
]]>
78
107
</programlisting>
79
-
&example.outputs;
108
+
&example.outputs.82.similar;
109
+
<screen>
110
+
<![CDATA[
111
+
.
112
+
..
113
+
apples.jpg
114
+
banana.jpg
115
+
example.php
116
+
]]>
117
+
</screen>
118
+
<para>Output of the above example prior to PHP 8.2.0 is similar to:</para>
80
119
<screen>
81
120
<![CDATA[
82
121
apples.jpg
...
...
@@ -98,7 +137,6 @@ example.php
98
137
</para>
99
138
</refsect1>
100
139
</refentry>
101
-

102
140
<!-- Keep this comment at the end of the file
103
141
Local variables:
104
142
mode: sgml
105
143