I made a Symfony2 bundle, which works fine with SensioFrameworkExtraBundle 2.x
But since Symfony 2.4, the SensioFrameworkExtraBundle used is 3.x and the apply()
and supports()
methods signature have changed.
This forces me to maintain 2 versions of my bundle... only because of that.
Is there a way to easily handle this kind of situation?
Is there some nice workaround I didn't think about?
Because it's very tedious to manage updates and fixes on 2 "identical" versions, living in parallel (modifying master branch, commit, switching to other branch, cherry-picking master commit, push the two versions, creating 2 release each time...)
Well, generally you do make a new version if your dependency API changes - aka on it's new major version.
Anyway, if those two methods are the only thing bothering you, you should write an adapter that will on one side expose fixed standard API towards your classes, while on the other side it will know how to use different/specific API of the dependency API different versions. Then you don't have to maintain two almost identical versions of your code, but only that adapter in single version. That way your code will depend on that adapter rather then the dependency itself, so you can tweak the adapter to accommodate new versions of dependency w/out changing the rest of your code.