xp-framework / compiler

Compiles future PHP to today's PHP.
19 stars 0 forks source link

Add emitting support for asymmetric visibility #183

Closed thekid closed 2 months ago

thekid commented 2 months ago

This pull request adds emitting support for asymmetric visibility using (set) specifiers on property modifiers

See https://wiki.php.net/rfc/asymmetric-visibility-v2 and xp-framework/compiler#182

thekid commented 2 months ago

Reflection

Here's a first idea:

$prop= $type->property('name');
$prop->modifiers();       // lang.reflection.Modifiers<public | private(set)>

$prop->modifiers('get');  // lang.reflection.Modifiers<public>
$prop->modifiers('set');  // lang.reflection.Modifiers<private>
thekid commented 2 months ago

Released in https://github.com/xp-framework/compiler/releases/tag/v9.2.0