Hey internals,

> On 4. Jun 2025, at 20:19, Nick <p...@nicksdot.dev> wrote:
>> I believe at the moment that RFC text is all there is. :-)  I don't know 
>> that it's worth opening a discussion without at least a mostly-done 
>> implementation.  Also, Ilija is rather busy on other tasks at the moment, as 
>> am I.  (Unless someone else wants to jump in to implement it, which would be 
>> fine.)
> 
> People often say “you can just do things”. So I did, and tried to contribute 
> the code for your existing RFC text:
> 
> https://github.com/php/php-src/pull/18757

Would this be expected to work? Can interface properties be declared `readonly`?
interface Cleaned
{
    public readonly string $clean { get; } // has readonly
}

class Something implements Cleaned
{
    public function __construct(
        public readonly string $clean {
            get => trim($this->clean);
        }
    ) {}
}

$u = new Something('   Yoda   ');
var_dump($u->clean);
In my current implementation it would throw:

> Fatal error: Hooked virtual properties cannot be readonly in 

I’d appreciate input here.
Thanks in advance!

Cheers,
Nick



Reply via email to