-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop using formatter constants in parsers #54
Conversation
@@ -30,11 +30,12 @@ protected function stringParse( $value ) { | |||
switch ( $value ) { | |||
case '': | |||
case 'gregorian': | |||
return TimeFormatter::CALENDAR_GREGORIAN; | |||
return IsoTimestampParser::CALENDAR_GREGORIAN; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having the constants in IsoTimestampParser
seems rather arbitrary to me as well. Just saying, not objecting to this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, true, I was thinking the same. Will move them to TimeValue
, I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned elsewhere, I think they should not go there unless TimeValue itself uses them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They don't "go" anywhere, they are already there, duplicated in both "formatter" and "parser" classes. I'm trying to deprecate at least one set of these constants now. This patch here is only a small step forward. More to come, as always.
cfaa61f
to
11bea50
Compare
11bea50
to
e89d3cd
Compare
new TimeValue( $timestamp, 0, 0, 0, $precision, $calendarModel ), | ||
$expected, | ||
$options | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just make the arguments to the test function optional. Much more obvious than this post-processing here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#49 contains a major refactoring of this. I did not wanted to repeat everything, this patch here contains only very basic stuff.
Needs a rebase. Would merge otherwise. |
e89d3cd
to
71fc45f
Compare
71fc45f
to
2c0d5e2
Compare
Rebased. Note that this is probably obsolete via #65. |
I have merged #65 so will close this |
TimeParser
will be renamed toIsoTimestampParser
in #39. That's why I'm usingas
. This will make the following patch super-trivial.