make product variant comparable#11580
Conversation
|
Hey Olivier, can you rebase to newest 1.7? It may fix the build. |
501402e to
6e146c4
Compare
98d3641 to
322894f
Compare
|
Hi @lchrusciel , Rebase is done, and "application" is green on Travis, but "doc" still red 😞 |
|
Our 1.7 branch is red again, we will try to fix it in the nearest days |
322894f to
a5efeb5
Compare
a5efeb5 to
077042a
Compare
| */ | ||
| public function compareTo($other): int | ||
| { | ||
| return $this->code === $other->getCode() ? 0 : 1; |
There was a problem hiding this comment.
- This method should not check for identity using ===, only for semantical equality for example
- when two different DateTime instances point to the exact same Date + TZ.
https://github.com/doctrine/common/blob/master/lib/Doctrine/Common/Comparable.php#L20-L21
I would also like to suggest using another interface because this 0 for 🥛 and 1 for ☕ is really tricky.
There was a problem hiding this comment.
If I understood correctly, for us it is indeed semantical equality when the codes are identical. Strong cooperation is used here more because of our standards rather than real need (as both codes will be strings)
|
Can you rebase again to 1.7? We could fix it there, I assume. |
077042a to
486597b
Compare
486597b to
f7c0dd5
Compare
|
The base of this pull-request was changed, you need fetch and reset your local branch Unless you added new commits (to this branch) locally that you did not push yet, Feel free to ask for assistance when you get stuck 👍 |
|
Thank you, @oallain! 🎉 |
| { | ||
| $this->setCode('test'); | ||
|
|
||
| $otherTaxon = new ProductVariant(); |
There was a problem hiding this comment.
| $otherTaxon = new ProductVariant(); | |
| $otherVariant = new ProductVariant(); |
Uh oh!
There was an error while loading. Please reload this page.