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

Align Chronos::getTimezone() return type with DateTimeImmutable #423

Merged
merged 1 commit into from
Sep 24, 2023

Conversation

othercorey
Copy link
Member

This avoids breaking compatibility and the need for an attribute.

@othercorey othercorey added this to the 3.x milestone Sep 23, 2023
return parent::getTimezone() ?: null;
$tz = parent::getTimezone();
if ($tz === false) {
throw new RuntimeException('Time zone could not be retrieved.');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's possible to trigger this and just reflects the internal timelib functions. Maybe if you serialized DateTimeImmutable with a time zone that was later removed? I'm not sure.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meh, I wouldn't worry about getting coverage on this case.

@othercorey othercorey merged commit aa49da4 into 3.x Sep 24, 2023
5 of 7 checks passed
@othercorey othercorey deleted the gettimezone-return branch September 24, 2023 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants