[DOC-CVS] [doc-en] master: WASM: Enable runnable examples for Predefined Interfaces & Classes (language/predefined) (#5485)
[email protected] (AllenJB via GitHub) Tue, 5 May 2026 21:49:48 +0000
| Newsgroups | php.doc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: AllenJB (AllenJB)
Committer: GitHub (web-flow)
Pusher: jordikroon
Date: 2026-05-05T23:49:45+02:00
Commit: https://github.com/php/doc-en/commit/4b06b2d5c3a28a13504972df0f0be6deffabb4c5
Raw diff: https://github.com/php/doc-en/commit/4b06b2d5c3a28a13504972df0f0be6deffabb4c5.diff
WASM: Enable runnable examples for Predefined Interfaces & Classes (language/predefined) (#5485)
Changed paths:
M language/predefined/arrayaccess.xml
M language/predefined/fiber.xml
M language/predefined/fibererror.xml
M language/predefined/interfaces.xml
M language/predefined/iteratoraggregate.xml
M language/predefined/serializable.xml
M language/predefined/unitenum/cases.xml
Diff:
diff --git a/language/predefined/arrayaccess.xml b/language/predefined/arrayaccess.xml
index a848272f2939..6c5cd30366ae 100644
--- a/language/predefined/arrayaccess.xml
+++ b/language/predefined/arrayaccess.xml
@@ -81,7 +81,6 @@ $obj[] = 'Append 1';
$obj[] = 'Append 2';
$obj[] = 'Append 3';
print_r($obj);
-?>
]]>
</programlisting>
&example.outputs.similar;
@@ -91,9 +90,9 @@ bool(true)
int(2)
bool(false)
string(7) "A value"
-obj Object
+Obj Object
(
- [container:obj:private] => Array
+ [container] => Array
(
[one] => 1
[three] => 3
diff --git a/language/predefined/fiber.xml b/language/predefined/fiber.xml
index fe79b39441a5..da6831abeb68 100644
--- a/language/predefined/fiber.xml
+++ b/language/predefined/fiber.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<reference xml:id="class.fiber" role="class" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
+<reference xml:id="class.fiber" role="class" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"
+ annotations="non-interactive">
<title>The Fiber class</title>
<titleabbrev>Fiber</titleabbrev>
diff --git a/language/predefined/fibererror.xml b/language/predefined/fibererror.xml
index 8162e02faf5e..d0643a375e3a 100644
--- a/language/predefined/fibererror.xml
+++ b/language/predefined/fibererror.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<reference xml:id="class.fibererror" role="exception" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
+<reference xml:id="class.fibererror" role="exception" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"
+ annotations="non-interactive">
<title>FiberError</title>
<titleabbrev>FiberError</titleabbrev>
diff --git a/language/predefined/interfaces.xml b/language/predefined/interfaces.xml
index 0372a79aa065..614ce57b5cb0 100644
--- a/language/predefined/interfaces.xml
+++ b/language/predefined/interfaces.xml
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
-<part xml:id="reserved.interfaces" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
+<part xml:id="reserved.interfaces" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ annotations="interactive">
<title>Predefined Interfaces and Classes</title>
<partintro>
diff --git a/language/predefined/iteratoraggregate.xml b/language/predefined/iteratoraggregate.xml
index dde3daaf8aa0..d2cb779060a9 100644
--- a/language/predefined/iteratoraggregate.xml
+++ b/language/predefined/iteratoraggregate.xml
@@ -49,19 +49,13 @@
class myData implements IteratorAggregate
{
- public $property1 = "Public property one";
- public $property2 = "Public property two";
- public $property3 = "Public property three";
- public $property4 = "";
-
- public function __construct()
- {
- $this->property4 = "last property";
- }
-
public function getIterator(): Traversable
{
- return new ArrayIterator($this);
+ return new ArrayIterator([
+ "key one" => "item one",
+ "key two" => "item two",
+ "key three" => "item three"
+ ]);
}
}
@@ -71,24 +65,19 @@ foreach ($obj as $key => $value) {
var_dump($key, $value);
echo "\n";
}
-
-?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
-string(9) "property1"
-string(19) "Public property one"
-
-string(9) "property2"
-string(19) "Public property two"
+string(7) "key one"
+string(8) "item one"
-string(9) "property3"
-string(21) "Public property three"
+string(7) "key two"
+string(8) "item two"
-string(9) "property4"
-string(13) "last property"
+string(9) "key three"
+string(10) "item three"
]]>
</screen>
diff --git a/language/predefined/serializable.xml b/language/predefined/serializable.xml
index 06e0ad36bb54..7bf30cd62090 100644
--- a/language/predefined/serializable.xml
+++ b/language/predefined/serializable.xml
@@ -88,6 +88,7 @@ var_dump($newobj->getData());
&example.outputs.similar;
<screen>
<![CDATA[
+Deprecated: obj implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in script on line 2
string(38) "C:3:"obj":23:{s:15:"My private data";}"
string(15) "My private data"
]]>
diff --git a/language/predefined/unitenum/cases.xml b/language/predefined/unitenum/cases.xml
index c8d85b12f004..48fb4f51995d 100644
--- a/language/predefined/unitenum/cases.xml
+++ b/language/predefined/unitenum/cases.xml
@@ -48,21 +48,20 @@ enum Suit
}
var_dump(Suit::cases());
-?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
array(4) {
- [0]=>
- enum(Suit::Hearts)
- [1]=>
- enum(Suit::Diamonds)
- [2]=>
- enum(Suit::Clubs)
- [3]=>
- enum(Suit::Spades)
+ [0]=>
+ enum(Suit::Hearts)
+ [1]=>
+ enum(Suit::Diamonds)
+ [2]=>
+ enum(Suit::Clubs)
+ [3]=>
+ enum(Suit::Spades)
}
]]>
</screen>