-
Notifications
You must be signed in to change notification settings - Fork 102
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
Update DocBlockHelper.php allow different date and time classes #948
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.
It would be good to have a test for this. You could have the date/time types mapped to the PHP DateTime classes.
sadly I am not able to write tests because of lack of knowledge |
@markusramsak You checkout your fork of this repo standalone, checkout your branch here, run
and adjust it with an additional test...() method that you want to test until it is green based |
Also note that PHPStan still has an issue with the code it seems:
|
I don't know how to solve it. It was changed for CakePHP 5 from @LordSimal but it is a regression because now it doesn't work anymore with overwritten DateTime oder Date class. I don't know why this change was made in the first place ... |
Ah ok, so this fail is unrelated to your PR and already in the main branch - then we can ignore this one for now :) |
I know I am missing the tests but the changes allow using custom Time/Date/DateTime classes which are used for annotations. Without this using only CakePHP default classes are used for annotation of entities which is regression to CakePHP 4.x and related bake version. |
How do I write a Test to confirm that my suggested code works? I want that Date, Time and DateTime classes could be overwritten (like before). How do I test this? It seems like a static validation to the Cake-Classes in the tests in DocBlockHelperTest.php at the moment ... |
This was removed in #929 because I thought this wasn't necessary anymore but clearly I was wrong 😅 |
Please could help me someone to get the tests working for this pull request so this change can be merged. I cannot update my Entity-Docs anymore until this change is merged. This change is actually nothing new - it was like that before for CakePHP 4.x |
We can take care of a testcase later. I'll just do a new release to add this feature back |
thanks for your help |
Sorry for taking so long to get this back in |
We are all doing this in our free time and have other obligations. I completely understand. |
@LordSimal Do we also need a IdeHelper update for this? |
will have to check later. My initial problem was just the fact, that |
since CakePHP 5.0 the overwritten DateTime or Date class is not used anymore for annotation.
I can't get Checks to pass, but I think it is clear what I want to achieve. It worked in the previous major version.