language/predefined/arrayaccess.xml
f94d903985119d3ac00f4528551df947f57b667f
...
...
@@ -1,6 +1,5 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-

4
3
<phpdoc:classref xml:id="class.arrayaccess" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
5
4

6
5
<title>The ArrayAccess interface</title>
...
...
@@ -21,42 +20,35 @@
21
20
&reftitle.interfacesynopsis;
22
21

23
22
<!-- {{{ Synopsis -->
24
-
<classsynopsis>
25
-
<ooclass><classname>ArrayAccess</classname></ooclass>
26
-

27
-
<!-- {{{ Class synopsis -->
28
-
<classsynopsisinfo>
29
-
<ooclass>
30
-
<classname>ArrayAccess</classname>
31
-
</ooclass>
32
-
</classsynopsisinfo>
33
-
<!-- }}} -->
23
+
<classsynopsis class="interface">
24
+
<oointerface>
25
+
<interfacename>ArrayAccess</interfacename>
26
+
</oointerface>
34
27

35
28
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
36
-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.arrayaccess')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
29
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.arrayaccess')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='ArrayAccess'])">
30
+
<xi:fallback/>
31
+
</xi:include>
37
32
</classsynopsis>
38
33
<!-- }}} -->
39
34

40
35
</section>
41
36

42
37
<section xml:id="arrayaccess.examples">
38
+
&reftitle.examples;
43
39
<example xml:id="arrayaccess.example.basic"><!-- {{{ -->
44
40
<title>Basic usage</title>
45
41
<programlisting role="php">
46
42
<![CDATA[
47
43
<?php
48
44
class Obj implements ArrayAccess {
49
-
private $container = array();
50
-

51
-
public function __construct() {
52
-
$this->container = array(
53
-
"one" => 1,
54
-
"two" => 2,
55
-
"three" => 3,
56
-
);
57
-
}
45
+
public $container = [
46
+
"one" => 1,
47
+
"two" => 2,
48
+
"three" => 3,
49
+
];
58
50

59
-
public function offsetSet($offset, $value) {
51
+
public function offsetSet($offset, $value): void {
60
52
if (is_null($offset)) {
61
53
$this->container[] = $value;
62
54
} else {
...
...
@@ -64,15 +56,15 @@ class Obj implements ArrayAccess {
64
56
}
65
57
}
66
58

67
-
public function offsetExists($offset) {
59
+
public function offsetExists($offset): bool {
68
60
return isset($this->container[$offset]);
69
61
}
70
62

71
-
public function offsetUnset($offset) {
63
+
public function offsetUnset($offset): void {
72
64
unset($this->container[$offset]);
73
65
}
74
66

75
-
public function offsetGet($offset) {
67
+
public function offsetGet($offset): mixed {
76
68
return isset($this->container[$offset]) ? $this->container[$offset] : null;
77
69
}
78
70
}
...
...
@@ -125,7 +117,6 @@ obj Object
125
117
&language.predefined.arrayaccess.offsetunset;
126
118

127
119
</phpdoc:classref>
128
-

129
120
<!-- Keep this comment at the end of the file
130
121
Local variables:
131
122
mode: sgml
132
123