Skip to content

Commit 3843755

Browse files
authored
Improve explanation of asymmetric visibility (#3989)
1 parent 462a8fb commit 3843755

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

appendices/migration84/new-features.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,17 @@ print $p->fullName; // Prints "Peter Peterson"
6262
<title>Asymmetric Property Visibility</title>
6363

6464
<simpara>
65-
Object properties may now have their <literal>set</literal> visibility controlled separately from the <literal>get</literal> visibility.
65+
Object properties may now have their <literal>set</literal> visibility
66+
controlled separately from the <literal>get</literal> visibility.
6667
</simpara>
6768
<informalexample>
6869
<programlisting role="php">
6970
<![CDATA[
7071
<?php
7172
class Example
7273
{
74+
// The first visibility modifier controls the get-visibility, and the second modifier
75+
// controls the set-visibility. The get-visibility must not be narrower than set-visibility.
7376
public protected(set) string $name;
7477
7578
public function __construct(string $name)

0 commit comments

Comments
 (0)