rouge
rouge copied to clipboard
php: Support asymmetric visibility
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.