Skip to content

new-features.xml Make the asymmetric visibility a little more underst… #3989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion appendices/migration84/new-features.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,17 @@ print $p->fullName; // Prints "Peter Peterson"
<title>Asymmetric Property Visibility</title>

<simpara>
Object properties may now have their <literal>set</literal> visibility controlled separately from the <literal>get</literal> visibility.
Object properties may now have their <literal>set</literal> visibility
controlled separately from the <literal>get</literal> visibility.
</simpara>
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
class Example
{
// The first visibility modifier controls the get-visibility, and the second modifier
// controls the set-visibility. The get-visibility must not be narrower than set-visibility.
public protected(set) string $name;

public function __construct(string $name)
Expand Down