> For point 1, we already have that. It's called abstract methods in traits. This is a solved problem that requires no further resolution. At best it would be a shorthand to copying a few methods from an interface into the trait and sticking "abstract" in front of them. I really don't see a need for that.

You can say exactly the same about traits in general - you don't need traits at all, since you can copy method implementation into multiple classes, in the same way as you're proposing to copy abstract methods declarations. But traits are implemented and they're useful - they reduce the amount of code duplication, which means less work and a smaller surface for errors. It is the same case for this proposal - if you don't need to copy&paste method declarations from an interface, that means less code duplication and possible errors. It should also make it easier for SCA tools to understand the code since they no longer need to know the whole project to understand that method from trait is implementation of method from interface (which is really tricky right now since it depends on context - trait can at the same implement and not implement the interface, because it depends on class where it is used). And finally, you could use `{@inheritdoc}` in some meaningful way in traits - right now there is no straightforward way to inherit phpdoc from the interface, and often this is what you want to do.


--
Regards,
Robert Korulczyk

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

Reply via email to