ruflin / Elastica

Elastica is a PHP client for elasticsearch
http://elastica.io/
MIT License
2.26k stars 736 forks source link

Mark classes as final #2101

Open franmomu opened 2 years ago

franmomu commented 2 years ago

Thinking about 8.0 I think we should mark as many classes as possible with @final to let the user know that they will become final in 8.0. This will ease the maintenance (reducing the number of possible BC breaks) and we can always revert this if there are valid use cases.

ruflin commented 2 years ago

I'm torn on this proposal. I see the benefit around maintenance. At the same time it removes flexibility. Every time someone wants to extend a function / class we didn't expect to be extended for their own benefit, a new release is needed. Instead if we go with extendable by default, there is a risk that some changes on our end might break things for this users if we get more strict. We had recently a few of these cases where we did kind of breaking changes but so far I don't think we have heard of any place where it actually was a breaking change.

I think both paths will work and lets discuss a bit more what is the right one for Elastica. What kind of classes did you plan to mark as final?