Core: [RFC] Policy of final classes maybe to hard

Created on 9 Jul 2018  路  1Comment  路  Source: api-platform/core

Hello,

I often add behavior to ApiPlatform classes. To do that decorating is stupid and copying the class is dangerous.

Considering I prefer to live dangerously than stupid, I copy the class. I think the systematic final for classes should be reconsidered.

Here are 2 example: I want to support new options in the yaml extractor / I want to support them inside the ExtractorPropertyMetadataFactory or I want to enforce one kind of ExtractorPropertyMetadataFactory because order of extractors is not good inside ApiPlatform...

Well, in this cases there's no better way than copy the code of ApiPlatform and hope the code will not evolve too much. I think it could be better by supporting extension (in particular in classes I speak about).

question

Most helpful comment

If there are extension points that could be added in a nice way, it'll of course be welcome. I don't believe that the policy of using final classes will change, as one of the intentions is to free us from having to deal with the additional maintenance workload of BC for subclasses.

>All comments

If there are extension points that could be added in a nice way, it'll of course be welcome. I don't believe that the policy of using final classes will change, as one of the intentions is to free us from having to deal with the additional maintenance workload of BC for subclasses.

Was this page helpful?
0 / 5 - 0 ratings