Closed dontub closed 5 years ago
I thought that custom comparison strategies would be so rare, which is why I decided to remove that ugly static method, but still when a user wants to roll custom one, they could still do the comparison like so: $customComparator->compare($version1, $version2)
.
But I do get your point, you would prefer to perform comparison through Version
class API. Can you show me some example where you would find it very useful?
I have the number of commits since the last git tag in the build part. So I additionally compare the build part if the previous parts are equal. For me it is very useful to just call Version::setComparator()
once in the bootstrap file and to use the Version
class API then. It also ensures that the use of the custom comparator cannot be forgotten (neither by me nor by others).
Ok, can you make a PR for Version::setComparator()
functionality, and then I'll consider it for 3.2.0?
FYI I'll give it a few more days before releasing 3.2.0
, but I've updated Composer branch alias to 3.2.x
so you can already pull it into your project (https://getcomposer.org/doc/articles/aliases.md#branch-alias).
Thanks.
An update at packagist.org would be nice :)
Done, thanks for a reminder!
In version 2 it is possible to change the version comparator via
Version::setComparator()
. This method was removed in version 3. I would highly appreciate if it comes back. Is that possible?