Skip to content

Commit

Permalink
Improve new content
Browse files Browse the repository at this point in the history
Use simpara according to new style guide
Fix indentation
Use semantic line breaks and reduce line length to 80 chars were reasonable as dictated by our style guide
  • Loading branch information
Girgias committed Nov 20, 2024
1 parent f9dabde commit 2e7c00f
Show file tree
Hide file tree
Showing 4 changed files with 337 additions and 308 deletions.
14 changes: 7 additions & 7 deletions language/oop5/abstract.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@
<link linkend="language.oop.lsp">signature compatibility</link> rules.
</para>

<para>
<simpara>
As of PHP 8.4, an abstract class may declare an abstract property, either public or protected.
A protected abstract property may be satisfied by a property that is readable/writeable from either
protected or public scope.
</para>
<para>
</simpara>
<simpara>
An abstract property may be satisfied either by a standard property or by a property
with defined <link linkend="language.oop5.property-hooks">hooks</link>, corresponding to the required operation.
</para>
</simpara>

<example>
<title>Abstract method example</title>
<programlisting role="php">
<programlisting role="php">
<![CDATA[
<?php
abstract class AbstractClass
Expand Down Expand Up @@ -171,10 +171,10 @@ class C extends A
]]>
</programlisting>
</example>
<para>
<simpara>
An abstract property on an abstract class may provide implementations for any hook,
but must have either <literal>get</literal> or <literal>set</literal> declared but not defined (as in the example above).
</para>
</simpara>
<example>
<title>Abstract property example</title>
<programlisting role="php">
Expand Down
24 changes: 14 additions & 10 deletions language/oop5/interfaces.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,21 @@
</sect2>
<sect2 xml:id="language.oop5.interfaces.properties">
<title>Properties</title>
<para>
As of PHP 8.4.0, interfaces may also declare properties. If they do, the declaration must specify if the
property is to be readable, writeable, or both. The interface declaration applies only to public read
and write access.
</para>
<para>
An class may satisfy an interface property in multiple ways. It may define a public property. It may
define a public <link linkend="language.oop5.property-hooks.virtual">virtual property</link> that implements
only the corresponding hook. Or a read property may be satisfied by a <literal>readonly</literal> property.
<simpara>
As of PHP 8.4.0, interfaces may also declare properties.
If they do, the declaration must specify if the property is to be readable,
writeable, or both.
The interface declaration applies only to public read and write access.
</simpara>
<simpara>
An class may satisfy an interface property in multiple ways.
It may define a public property.
It may define a public
<link linkend="language.oop5.property-hooks.virtual">virtual property</link>
that implements only the corresponding hook.
Or a read property may be satisfied by a <literal>readonly</literal> property.
However, an interface property that is settable may not be <literal>readonly</literal>.
</para>
</simpara>
<example>
<title>Interface properties example</title>
<programlisting role="php">
Expand Down
Loading

0 comments on commit 2e7c00f

Please sign in to comment.