rouge icon indicating copy to clipboard operation
rouge copied to clipboard

php: Support asymmetric visibility

Open nsfisis opened this issue 1 month ago • 0 comments

Part of https://github.com/rouge-ruby/rouge/issues/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 avatar Nov 01 '25 15:11 nsfisis