Skip to content

Commit 6f9e7e7

Browse files
committed
Enable runnable (WASM) examples for Predefined Interfaces & Classes (language/predefined)
1 parent ddc2a2d commit 6f9e7e7

7 files changed

Lines changed: 28 additions & 37 deletions

File tree

language/predefined/arrayaccess.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ $obj[] = 'Append 1';
8181
$obj[] = 'Append 2';
8282
$obj[] = 'Append 3';
8383
print_r($obj);
84-
?>
8584
]]>
8685
</programlisting>
8786
&example.outputs.similar;
@@ -91,9 +90,9 @@ bool(true)
9190
int(2)
9291
bool(false)
9392
string(7) "A value"
94-
obj Object
93+
Obj Object
9594
(
96-
[container:obj:private] => Array
95+
[container] => Array
9796
(
9897
[one] => 1
9998
[three] => 3

language/predefined/fiber.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<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">
2+
<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"
3+
annotations="non-interactive">
34
<title>The Fiber class</title>
45
<titleabbrev>Fiber</titleabbrev>
56

language/predefined/fibererror.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<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">
2+
<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"
3+
annotations="non-interactive">
34
<title>FiberError</title>
45
<titleabbrev>FiberError</titleabbrev>
56

language/predefined/interfaces.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
33

4-
<part xml:id="reserved.interfaces" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
4+
<part xml:id="reserved.interfaces" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
5+
annotations="interactive">
56
<title>Predefined Interfaces and Classes</title>
67

78
<partintro>

language/predefined/iteratoraggregate.xml

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,13 @@
4949
5050
class myData implements IteratorAggregate
5151
{
52-
public $property1 = "Public property one";
53-
public $property2 = "Public property two";
54-
public $property3 = "Public property three";
55-
public $property4 = "";
56-
57-
public function __construct()
58-
{
59-
$this->property4 = "last property";
60-
}
61-
6252
public function getIterator(): Traversable
6353
{
64-
return new ArrayIterator($this);
54+
return new ArrayIterator([
55+
"key one" => "item one",
56+
"key two" => "item two",
57+
"key three" => "item three"
58+
]);
6559
}
6660
}
6761
@@ -71,24 +65,19 @@ foreach ($obj as $key => $value) {
7165
var_dump($key, $value);
7266
echo "\n";
7367
}
74-
75-
?>
7668
]]>
7769
</programlisting>
7870
&example.outputs.similar;
7971
<screen>
8072
<![CDATA[
81-
string(9) "property1"
82-
string(19) "Public property one"
83-
84-
string(9) "property2"
85-
string(19) "Public property two"
73+
string(7) "key one"
74+
string(8) "item one"
8675
87-
string(9) "property3"
88-
string(21) "Public property three"
76+
string(7) "key two"
77+
string(8) "item two"
8978
90-
string(9) "property4"
91-
string(13) "last property"
79+
string(9) "key three"
80+
string(10) "item three"
9281
9382
]]>
9483
</screen>

language/predefined/serializable.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ var_dump($newobj->getData());
8888
&example.outputs.similar;
8989
<screen>
9090
<![CDATA[
91+
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
9192
string(38) "C:3:"obj":23:{s:15:"My private data";}"
9293
string(15) "My private data"
9394
]]>

language/predefined/unitenum/cases.xml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,20 @@ enum Suit
4848
}
4949
5050
var_dump(Suit::cases());
51-
?>
5251
]]>
5352
</programlisting>
5453
&example.outputs;
5554
<screen>
5655
<![CDATA[
5756
array(4) {
58-
[0]=>
59-
enum(Suit::Hearts)
60-
[1]=>
61-
enum(Suit::Diamonds)
62-
[2]=>
63-
enum(Suit::Clubs)
64-
[3]=>
65-
enum(Suit::Spades)
57+
[0]=>
58+
enum(Suit::Hearts)
59+
[1]=>
60+
enum(Suit::Diamonds)
61+
[2]=>
62+
enum(Suit::Clubs)
63+
[3]=>
64+
enum(Suit::Spades)
6665
}
6766
]]>
6867
</screen>

0 commit comments

Comments
 (0)