On 28 May 2023 01:09:39 BST, David Gebler <davidgeb...@gmail.com> wrote:
>
>I would say getters and setters don't [as a rule-of-thumb] really belong on
>interfaces, since they by definition relate to properties of an object and
>properties are by definition an implementation detail.

I don't follow. If a property is public, then code outside the class can rely 
on being able to access it. That seems to me to be a contract between the class 
and its users, not an implementation detail - e.g. removing the property, or 
changing its type, would be a compatibility break. A property can also be 
inherited from a base class, at which point there is a contract that all 
descendants of that base class will have the property available. So it seems 
logical that that contract could also be included in an interface.

Regards,

-- 
Rowan Tommins
[IMSoP]

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

Reply via email to