Le 07/07/2021 à 23:16, Larry Garfield a écrit :
The property accessor RFC (which didn't get to a vote) discussed this, and 
specifically proposed making properties part of the interface for... basically 
all the reasons given here.

My preference would be to add property accessors in 8.2 (at least the asymmetric 
visibility part), and then redefine `readonly` properties as a shorthand for a "get 
only" implicit accessor property; which, if I recall correctly, is essentially the 
same semantics as `readonly`.  (I didn't check the RFC; I'm going by memory here.)  That 
would include interface properties by nature.

--Larry Garfield

Using property accessors on interfaces is fine too, but the one thing that properties directly being defined on interfaces do bring is that you don't have to repeat implementation of those in your implementations. That's a detail, but a practical one.

Regards,

--

Pierre

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to