File tree Expand file tree Collapse file tree 4 files changed +337
-308
lines changed Expand file tree Collapse file tree 4 files changed +337
-308
lines changed Original file line number Diff line number Diff line change 21
21
<link linkend =" language.oop.lsp" >signature compatibility</link > rules.
22
22
</para >
23
23
24
- <para >
24
+ <simpara >
25
25
As of PHP 8.4, an abstract class may declare an abstract property, either public or protected.
26
26
A protected abstract property may be satisfied by a property that is readable/writeable from either
27
27
protected or public scope.
28
- </para >
29
- <para >
28
+ </simpara >
29
+ <simpara >
30
30
An abstract property may be satisfied either by a standard property or by a property
31
31
with defined <link linkend =" language.oop5.property-hooks" >hooks</link >, corresponding to the required operation.
32
- </para >
32
+ </simpara >
33
33
34
34
<example >
35
35
<title >Abstract method example</title >
36
- <programlisting role =" php" >
36
+ <programlisting role =" php" >
37
37
<![CDATA[
38
38
<?php
39
39
abstract class AbstractClass
@@ -171,10 +171,10 @@ class C extends A
171
171
]]>
172
172
</programlisting >
173
173
</example >
174
- <para >
174
+ <simpara >
175
175
An abstract property on an abstract class may provide implementations for any hook,
176
176
but must have either <literal >get</literal > or <literal >set</literal > declared but not defined (as in the example above).
177
- </para >
177
+ </simpara >
178
178
<example >
179
179
<title >Abstract property example</title >
180
180
<programlisting role =" php" >
Original file line number Diff line number Diff line change 91
91
</sect2 >
92
92
<sect2 xml : id =" language.oop5.interfaces.properties" >
93
93
<title >Properties</title >
94
- <para >
95
- As of PHP 8.4.0, interfaces may also declare properties. If they do, the declaration must specify if the
96
- property is to be readable, writeable, or both. The interface declaration applies only to public read
97
- and write access.
98
- </para >
99
- <para >
100
- An class may satisfy an interface property in multiple ways. It may define a public property. It may
101
- define a public <link linkend =" language.oop5.property-hooks.virtual" >virtual property</link > that implements
102
- only the corresponding hook. Or a read property may be satisfied by a <literal >readonly</literal > property.
94
+ <simpara >
95
+ As of PHP 8.4.0, interfaces may also declare properties.
96
+ If they do, the declaration must specify if the property is to be readable,
97
+ writeable, or both.
98
+ The interface declaration applies only to public read and write access.
99
+ </simpara >
100
+ <simpara >
101
+ An class may satisfy an interface property in multiple ways.
102
+ It may define a public property.
103
+ It may define a public
104
+ <link linkend =" language.oop5.property-hooks.virtual" >virtual property</link >
105
+ that implements only the corresponding hook.
106
+ Or a read property may be satisfied by a <literal >readonly</literal > property.
103
107
However, an interface property that is settable may not be <literal >readonly</literal >.
104
- </para >
108
+ </simpara >
105
109
<example >
106
110
<title >Interface properties example</title >
107
111
<programlisting role =" php" >
You can’t perform that action at this time.
0 commit comments