Skip to content

Conversation

@nsfisis
Copy link
Contributor

@nsfisis nsfisis commented Nov 1, 2025

Part of #2169

Support asymmetric property visibility since PHP 8.4.

https://www.php.net/manual/en/language.oop5.visibility.php#language.oop5.visibility-members-aviz

class Book
{
    public function __construct(
        public private(set) string $title,
        public protected(set) string $author,
        protected private(set) int $pubYear,
    ) {}
}

As described below, private(set) is recognized as single token.

Note: Spaces are not allowed in the set-visibility declaration. private(set) is correct. private( set ) is not correct and will result in a parse error.

@nsfisis nsfisis mentioned this pull request Nov 1, 2025
6 tasks
Co-authored-by: Tan Le <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants