Marcos Passos wrote: > Supporting `static` return would come in handy to define interfaces for > immutable objects.
But it's not a requirement, right? With this RFC, the following code will work: class ParentImmutable { function modify() : ParentImmutable { ... } } class ChidImmutable extends ParentImmutable { function modify() : ChidImmutable { ... } } Why should the RFC be expanded in scope to enforcing that child classes use more specific types? On Tue, 27 Nov 2018 at 21:16, Larry Garfield <la...@garfieldtech.com> wrote: > Levi, is that something that could be reasonably added to this RFC > I don't know that a static/self parameter declaration is even a thing Currently, static, self and parent are really more syntactic sugar that only apply in specific contexts, rather than actual types. This is a great source of sadness when it comes to their use in 'callable': https://wiki.php.net/rfc/consistent_callables . If I (or some other brave soul) finds enough fortitude to pickup that RFC, their use in the language might decrease. But more importantly, expanding the RFC from 'allowing variance to happen' to 'enforcing that child classes use variance' seems quite a big step, and would really need a separate strong rational of why it is needed, and why the added complexity is a good trade-off when it doesn't seem to be required for the use-case that it is being suggested for. It definitely needs a stronger argument for it, other than just saying it would be possible. cheers Dan Ack -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php