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

Change only Chronos to extend DateTimeImmutable once again #417

Merged
merged 1 commit into from
Sep 23, 2023

Conversation

othercorey
Copy link
Member

@othercorey othercorey commented Sep 16, 2023

The original reasons for this change are described here: #410 (comment)

  • Need to improve unit tests with more non-Chronos arguments now that the type declarations are relaxed.

@othercorey othercorey added this to the 3.x milestone Sep 16, 2023
@othercorey othercorey force-pushed the extend-datetimeimmutable branch 8 times, most recently from 6d236a3 to d3582ca Compare September 17, 2023 04:01
@othercorey
Copy link
Member Author

Removed unnecessary Chronos type declaration from formatter methods.

Copy link
Member

@markstory markstory left a comment

Choose a reason for hiding this comment

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

Would we want to release this as 3.1.0?

@@ -998,7 +970,7 @@ public function format(string $format): string
*/
public function getOffset(): int
{
return $this->native->getOffset();
return parent::getOffset();
Copy link
Member

Choose a reason for hiding this comment

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

Is there much point in retaining methods like these if they only call parent?

Copy link
Member Author

Choose a reason for hiding this comment

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

Only if we want to ensure the type hints are available. I think most IDE's can figure this class out though.

I was thinking about commenting out the ones we don't need to wrap for types, but not delete them. We never know what PHP 9 will bring.

@othercorey
Copy link
Member Author

othercorey commented Sep 19, 2023

Would we want to release this as 3.1.0?

Up to you. It would make it possible for people to transition without forcing it on them, but we do want this to be official. However, the only feedback we've seen was initially negative (or at least not positive) to not extending DateTimeImmutable.

CakePHP 5 deps need to be updated to only support this.

@othercorey othercorey merged commit e1a5d70 into 3.x Sep 23, 2023
6 of 7 checks passed
@othercorey othercorey deleted the extend-datetimeimmutable branch September 23, 2023 02:07
Comment on lines -2591 to -2594
public function toNative(): DateTimeImmutable
{
return $this->native;
}

Choose a reason for hiding this comment

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

This method was REMOVED in a BUGFIX release?! This change would have broken production releases if our automated testing didn't catch it.

Copy link
Member

Choose a reason for hiding this comment

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

The removal was a mistake, we'll get that fixed.

markstory added a commit that referenced this pull request Oct 2, 2023
This was accidently removed in the shuffle of #417 and #427

Fixes #432
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.

5 participants