Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

thiemowmde
Copy link
Contributor

TimeParser will be renamed to IsoTimestampParser in #39. That's why I'm using as. This will make the following patch super-trivial.

@@ -30,11 +30,12 @@ protected function stringParse( $value ) {
switch ( $value ) {
case '':
case 'gregorian':
return TimeFormatter::CALENDAR_GREGORIAN;
return IsoTimestampParser::CALENDAR_GREGORIAN;
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@thiemowmde thiemowmde force-pushed the formatterConsts branch 2 times, most recently from cfaa61f to 11bea50 Compare April 1, 2015 10:19
@thiemowmde thiemowmde added this to the 0.7 milestone Apr 14, 2015
new TimeValue( $timestamp, 0, 0, 0, $precision, $calendarModel ),
$expected,
$options
);

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.

Copy link
Contributor Author

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.

@brightbyte
Copy link

Needs a rebase. Would merge otherwise.

@thiemowmde thiemowmde modified the milestones: 0.7, 0.8 Apr 20, 2015
@thiemowmde
Copy link
Contributor Author

Rebased. Note that this is probably obsolete via #65.

@addshore
Copy link
Contributor

addshore commented Jun 2, 2015

I have merged #65 so will close this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants