RSS Amplifier

Mountain Of Code · Jan 2, 2026

PHP Asymmetric Visibility Cheat Sheet

0
Sign in to vote or save

This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.

PHP 8.4 added support for property asymmetric visibility . This feature allows controlling get/set access separately. It includes a bunch of shorthand and implicit declarations which make it hard to remember. Below is my attempt to create a cheat-sheet which documents all the possibilities. Declaration Get Set Effective Definition public public public public public(set) protected protected…

PHP 8.4 added support for property asymmetric visibility. This feature allows controlling get/set access separately. It includes a bunch of shorthand and implicit declarations which make it hard to remember.

Below is my attempt to create a cheat-sheet which documents all the possibilities.

Declaration Get Set Effective Definition
public public public public public(set)
protected protected protected protected protected(set)
private private private final private private(set)
public(set) public public public public(set)
protected(set) public protected protected protected(set)
private(set) public private final private private(set)
public public(set) public public public public(set)
public protected(set) public protected public protected(set)
public private(set) public private final public private(set)
protected public(set) invalid invalid
protected protected(set) protected protected
protected private(set) protected private final protected private(set)
private public(set) invalid invalid
private protected(set) invalid invalid
private private(set) private private final private private(set)
public readonly public protected public protected(set) readonly
protected readonly protected protected protected protected(set) readonly
private readonly private private final private private(set) readonly

Read on /php-async-visibility-defaults

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.