brick / date-time

Date and time library for PHP
MIT License
326 stars 30 forks source link

Consider adding equals() method to all value classes #9

Closed joshdifabio closed 4 years ago

joshdifabio commented 5 years ago

An equals($value) method on all value classes (no type declaration on the parameter) would make this library much easier to work with in combination with other libraries which deal with generic value types, e.g. https://github.com/Space48/auto-value-php.

BenMorel commented 5 years ago

Are you suggesting that I relax the type-hinting currently used in isEqualTo() methods, and replace it with an additional instanceof check?

I currently can't see the value of this approach: why would I ever compare a LocalDate with a LocalTime, for example?

BenMorel commented 4 years ago

I'm closing this issue due to lack of feedback.

As mentioned above, most classes implement an isEqualTo() method, that compares to objects of the same type. I currently don't see a value in comparing to objects of other types, if that's what the issue is about.

Please feel free to comment if you wish to reopen the discussion.