Skip to content

Commit 267a3d4

Browse files
authored
Move Countable to predefined interfaces out from SPL (#1664)
It has been part of core since 7.2, so let's stop lying.
1 parent c82f29b commit 267a3d4

File tree

4 files changed

+21
-27
lines changed

4 files changed

+21
-27
lines changed

reference/spl/countable.xml renamed to language/predefined/countable.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
</partintro>
3939

40-
&reference.spl.entities.countable;
40+
&language.predefined.countable.count;
4141

4242
</reference>
4343
<!-- Keep this comment at the end of the file

reference/spl/countable/count.xml renamed to language/predefined/countable/count.xml

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<refentry xml:id="countable.count" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
3+
<refentry xml:id="countable.count" xmlns="http://docbook.org/ns/docbook">
44
<refnamediv>
55
<refname>Countable::count</refname>
66
<refpurpose>Count elements of an object</refpurpose>
@@ -12,10 +12,11 @@
1212
<modifier>public</modifier> <type>int</type><methodname>Countable::count</methodname>
1313
<void/>
1414
</methodsynopsis>
15-
<para>
16-
This method is executed when using the <function>count</function> function on an
17-
object implementing <classname>Countable</classname>.
18-
</para>
15+
<simpara>
16+
This method is executed when the <parameter>value</parameter> for
17+
<function>count</function> is an object implementing
18+
<classname>Countable</classname>.
19+
</simpara>
1920
</refsect1>
2021

2122
<refsect1 role="parameters">
@@ -25,41 +26,36 @@
2526

2627
<refsect1 role="returnvalues">
2728
&reftitle.returnvalues;
28-
<para>
29+
<simpara>
2930
The custom count as an <type>int</type>.
30-
</para>
31-
<note>
32-
<para>
33-
The return value is cast to an <type>int</type>.
34-
</para>
35-
</note>
31+
</simpara>
3632
</refsect1>
3733

3834
<refsect1 role="examples">
3935
&reftitle.examples;
40-
<para>
41-
<example>
42-
<title><function>Countable::count</function> example</title>
43-
<programlisting role="php">
36+
<example>
37+
<title><function>Countable::count</function> example</title>
38+
<programlisting role="php">
4439
<![CDATA[
4540
<?php
46-
class myCounter implements Countable {
41+
class Counter implements Countable {
4742
private $count = 0;
43+
4844
public function count() {
4945
return ++$this->count;
5046
}
5147
}
5248
5349
$counter = new myCounter;
5450
55-
for($i=0; $i<10; ++$i) {
51+
for ($i = 0; $i < 10; ++$i) {
5652
echo "I have been count()ed " . count($counter) . " times\n";
5753
}
5854
?>
5955
]]>
60-
</programlisting>
61-
&example.outputs.similar;
62-
<screen>
56+
</programlisting>
57+
&example.outputs.similar;
58+
<screen>
6359
<![CDATA[
6460
I have been count()ed 1 times
6561
I have been count()ed 2 times
@@ -72,9 +68,8 @@ I have been count()ed 8 times
7268
I have been count()ed 9 times
7369
I have been count()ed 10 times
7470
]]>
75-
</screen>
76-
</example>
77-
</para>
71+
</screen>
72+
</example>
7873
</refsect1>
7974

8075
</refentry>

language/predefined/interfaces.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
&language.predefined.iteratoraggregate;
1717
&language.predefined.internaliterator;
1818
&language.predefined.throwable;
19+
&language.predefined.countable;
1920
&language.predefined.arrayaccess;
2021
&language.predefined.serializable;
2122
&language.predefined.closure;

reference/spl/interfaces.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
<section xml:id="spl.interfaces.list">
1212
&spl.interfaces.list;
1313
<simplelist>
14-
<member><classname>Countable</classname></member>
1514
<member><classname>OuterIterator</classname></member>
1615
<member><classname>RecursiveIterator</classname></member>
1716
<member><classname>SeekableIterator</classname></member>
@@ -22,7 +21,6 @@
2221

2322
</partintro>
2423

25-
&reference.spl.countable;
2624
&reference.spl.outeriterator;
2725
&reference.spl.recursiveiterator;
2826
&reference.spl.seekableiterator;

0 commit comments

Comments
 (0)