Hi internals,
With read-only properties, we no longer need to define getter methods when we can take advantage of them.
However, there is still one problem here from a convenience standpoint. That is if we use an interface, we still need to define a getter method.
This was mentioned by @sakurairo in X
Therefore, I propose to allow public properties to be defined on the interface (It does not matter whether it is read-only or not).
I would like to hear your feedback.
Also, if a similar discussion has taken place before, I would appreciate it if you could let me know.
Regards.
Saki
Hi internals,
With read-only properties, we no longer need to define getter methods
when we can take advantage of them.However, there is still one problem here from a convenience standpoint.
That is if we use an interface, we still need to define a getter method.This was mentioned by @sakurairo in X
Therefore, I propose to allow public properties to be defined on the
interface (It does not matter whether it is read-only or not).I would like to hear your feedback.
Also, if a similar discussion has taken place before, I would
appreciate it if you could let me know.Regards.
Saki
This functionality is included in the Property Hooks RFC, which will be going to a vote just as soon as Ilija finishes polishing up the test suite for it. (I think he wants to get it into a "commit as soon as the vote passes" state before we call the vote, even though that's not process-required.)
https://wiki.php.net/rfc/property-hooks#interfaces
--Larry Garfield
Hi Larry,
This functionality is included in the Property Hooks RFC, which will be going to a vote just as soon as Ilija finishes polishing up the test suite for it. (I think he wants to get it into a "commit as soon as the vote passes" state before we call the vote, even though that's not process-required.)
Oops, I haven't fully figured out that RFC yet and didn't realize my suggestion was included. Thanks for pointing that out!
Regards.
Saki
Le 28 mars 2024 à 16:03, Saki Takamachi saki@sakiot.com a écrit :
Therefore, I propose to allow public properties to be defined on the interface (It does not matter whether it is read-only or not).
Hi,
For information, the question of properties on interfaces is covered by the currently discussed RFC “Property hooks”: https://wiki.php.net/rfc/property-hooks
—Claude
Hi Claude,
For information, the question of properties on interfaces is covered by the currently discussed RFC “Property hooks”: https://wiki.php.net/rfc/property-hooks
I only half-understand that RFC. Thanks for pointing me out.
Regards.
Saki