Le 03/07/2023 à 13:32, Michał Marcin Brzuchalski a écrit :
I voted "yes", my personal use case waits for this feature. My use
case example:

https://gist.github.com/brzuchal/89e9481bbd34a6ce3d95a68eabff038b

With interface default methods I'd no longer need traits that implement a
single or in rare cases 2 methods that
use their respective methods returning objects and iterate in Generator
fashion over a paginated result set.
This is not an issue if there is one implementation of the interface but
when I decorate to apply some:
* caching
* logging
* failover

then the trait has to be attached to every class besides that it has to
exist which is an additional symbol here.

Cheers,
Michał Marcin Brzuchalski

Please everyone yes to this !

I use Symfony daily, and the SomethingAwareInterface / SomethingAwareTrait is very annoying, by having default method implementations on interfaces, it would remove the use of having traits at all. Everything would be much easier to read and write.

LoggerAwareInterface would no longer require us to use LoggerAwareTrait on every class, etc...

This is kind of sugar candy I'd really love.

Best regards,

--

Pierre

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

Reply via email to