Make IntegerRangeType represent open intervals properly#409
Conversation
8ef3293 to
7a7ae06
Compare
|
I really like this approach, moving stuff to Type usually tends to clean things up :) I'd definitely like to have the method on I'll review and merge this PR as it is, we can move and rename the method in a late rPR. |
|
Or |
ondrejmirtes
left a comment
There was a problem hiding this comment.
I feel like method names should be verbs (commands)...
This removes the usage of PHP_INT_MIN and PHP_INT_MAX to mark open-ended intervals and instead uses null for that purpose. Since using getMin() and getMax() now became slightly more complicated for callers, a lot of IntegerRangeType related logic has been moved into the class itself.
7a7ae06 to
401815f
Compare
|
Is this okay now, or should I change anything? |
|
Yes, thank you very much :) As a next step, we should move |
This removes the usage of
PHP_INT_MINandPHP_INT_MAXto mark open-ended intervals and instead usesnullfor that purpose. Since usinggetMin()andgetMax()now became slightly more complicated for callers, a lot ofIntegerRangeType-related logic has been moved into the class itself.I especially like that some type combinator logic is now inside the type class, but without too much pressure, since it is allowed to return
nullwhen it can't handle the situation. Perhaps this could be extended into the entireTypehierarchy.