-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
base: main
Are you sure you want to change the base?
Conversation
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.
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.
@mbabker, I'd like to hear your thoughts on this. |
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. |
@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 |
If this is planned for 4.0, does it make sense to change it to DateTimeImmutable for php type and doctrine? |
As @mbabker said, the ODM implementation should be updated too.
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. |
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