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

[Timestampable] - Add types to createdAt and updatedAt #2908

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

giosal
Copy link

@giosal giosal commented Jan 3, 2025

Based on the requirements of our project to be compatible with PHPStan Level 10, I had to add the types to createdAt and updatedAt, as we're using Timestampable in some of our entities

Copy link
Collaborator

@phansys phansys left a comment

Choose a reason for hiding this comment

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

Thank you @giosal!

For BC reasons, we can not introduce these changes in a minor version.

If these traits are used alongside an interface covering the same methods, this will force the implementation to be updated.

For the PHPStan level bump, I think we can use #2902 as starting point, allowing the changes here to be implemented in the future.

@phansys
Copy link
Collaborator

phansys commented Jan 14, 2025

@mbabker, I'd like to hear your thoughts on this.

@mbabker
Copy link
Contributor

mbabker commented Jan 14, 2025

IMO this is a good 4.0 change but isn't safe to ship as part of a minor release (plus the PR as is right now is incomplete as it doesn't update the ODM trait).

The traits here are purely convenience features and not required for an application to use, so for apps that do need strict type declarations, they can inline this code and update it as needed.

@giosal
Copy link
Author

giosal commented Jan 14, 2025

@phansys if I understood correctly, the changes you request are to update the ODM trait?

Otherwise, thank you for your review and your acceptance of the idea even if for a major version

@Chris53897
Copy link
Contributor

If this is planned for 4.0, does it make sense to change it to DateTimeImmutable for php type and doctrine?

@phansys
Copy link
Collaborator

phansys commented Jan 14, 2025

@phansys if I understood correctly, the changes you request are to update the ODM trait?

As @mbabker said, the ODM implementation should be updated too.

Otherwise, thank you for your review and your acceptance of the idea even if for a major version

Yes, these changes should be present in the next MAJOR release, as for BC reasons, they can not be introduced in a MINOR release: https://3v4l.org/q0qFe#v7.4.0.

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.

4 participants