Problem/Motivation
The doxygen on \Drupal\Component\DateTimePlus are out of date and do not match the type signature for the functions in the class. These need to be fixed.
Proposed resolution
Update doxygen for
\Drupal\Component\DateTimePlus::createFromDateTime()
\Drupal\Component\DateTimePlus::createFromArray()
\Drupal\Component\DateTimePlus::createFromTimestamp()
\Drupal\Component\DateTimePlus::createFromFormat()
\Drupal\Component\DateTimePlus::prepareTime()
\Drupal\Component\DateTimePlus::prepareTimezone()
\Drupal\Component\DateTimePlus::prepareFormat()
\Drupal\Component\DateTimePlus::hasErrors()
\Drupal\Component\DateTimePlus::getErrors()
Remaining tasks
Fix remaining instances.
User interface changes
None.
API changes
None.
Data model changes
None.
Release Eval
This is eligible for 8.1.x per the policy under
- API documentation improvements
Original report
While working on other issue I spotted incomplete doxygen comment. Having fully specified function description helps prevent unhandled exception cases, so here is a
simple patch.
Comment | File | Size | Author |
---|---|---|---|
#25 | update_doxygen_for-2702835-25.patch | 3.75 KB | Anonymous (not verified) |
#25 | interdiff-23-25.txt | 1.15 KB | Anonymous (not verified) |
#23 | update_doxygen_for-2702835-23.patch | 3.81 KB | Anonymous (not verified) |
#23 | interdiff-19-23.txt | 1.62 KB | Anonymous (not verified) |
#19 | interdiff-17-19.txt | 413 bytes | himanshugautam |
Comments
Comment #2
mpdonadioTotal nit, but the convention is for a blank comment line between the sections, so there should be one above the @throws line.
Otherwise, fine with the wording; phrasing is consistent with other similar exceptions. This would be eligible under the allowed changes to go into 8.1.x as a patch release b/c it is an API documentation improvement. Should do a quick IS update to follow the template.
Comment #3
ztl8702 CreditAttribution: ztl8702 as a volunteer commentedComment #4
ztl8702 CreditAttribution: ztl8702 as a volunteer commentedComment #5
mpdonadio@ztl8702, normally, we try to post an interdiff when posting a new patch so we can see what has changed. No worries on this, though, since it is a simple patch.
Comment #6
alexpottI think it is worth to re-scope this issue to fix this issue for all the methods in DateTimePlus as there are quite a few methods in this class that throw exceptions
Comment #7
mpdonadioEdited IS to re-scope issue per #6 w/ the methods that PhpStorm complained about.
Comment #8
ztl8702 CreditAttribution: ztl8702 as a volunteer commentedComment #9
ztl8702 CreditAttribution: ztl8702 as a volunteer commentedComment #10
mpdonadioThanks for the quick turnaround. Just a few small things, and I'll RTBC this.
General convention in core is to not fully qualify the class in these. I think it can simply be "A new DateTimePlus object." (This is somewhat obvious from the static constructors, but this pattern is used a lot in core.)
Same as above.
Same as above.
For future reviewers, I think the comment on the method when you read this in context explains this fully and more details on the return value isn't needed.
Same as above.
As above, I'm fine w/o additional info here.
Comment #11
ztl8702 CreditAttribution: ztl8702 as a volunteer commented@mpdonadio thanks for your detailed instructions.
Comment #12
ztl8702 CreditAttribution: ztl8702 as a volunteer commentedComment #13
ztl8702 CreditAttribution: ztl8702 as a volunteer commentedComment #14
mpdonadioThanks, I think this looks perfect. But, I need to read it applied before I RTBC it, which I can't do until tonight.
Comment #15
mpdonadioOK, patch looks good. In looking at this in context, let's do this right and also add
- @return for hasErrors
- @return for getErrors
so they at least typehint properly.
The docs in this class aren't up to our current quality, but I think I want to stop the scope of the issue here. The protected properties need types, and some of the comments are wrong, but we can clean that up later.
Comment #16
himanshugautam CreditAttribution: himanshugautam commentedadded
@return boolean
and@return string
to hasErrors and getErrorsI am new here and want to learn.
Please correct if I anything wrong
Comment #17
himanshugautam CreditAttribution: himanshugautam commentedComment #18
mpdonadio#16, thanks for the patch. We normally try to post an interdiff so we can easily see what has changed patch-to-patch. I attached one for your changes.
This is an array.
Comment #19
himanshugautam CreditAttribution: himanshugautam commentedSorry @mpdonadio, for some reason I want not able to upload the interdiff.
Made changes again uploading interdiff
Comment #20
himanshugautam CreditAttribution: himanshugautam commentedComment #21
mpdonadioThis class still has issues, but I am happy with the improvements that this patch provides. Further doc updates are premature before we look at better look at whether there are refactoring opportunities.
Comment #22
alexpottIf we are going to add these @return's in this patch then let's at least not docs which don't conform to the standards. These all need a description.
Comment #23
Anonymous (not verified) CreditAttribution: Anonymous at XIO commentedAdded the descriptions as requested in #22.
Comment #24
mpdonadioThanks. I think we need a few tweaks before this is ready. DREditor is being weird. I hope these make sense.
For the return value for prepareTime(), how about 'The massaged time.'
For prepareTimezone(), how about 'The massaged time zone.'
For prepareFormat(), how about 'The massaged PHP format string.'
These better match the comments where they are used.
Comment #25
Anonymous (not verified) CreditAttribution: Anonymous at XIO commentedI like how that's shorter and less repetitive, yet still clear. Thanks!
Comment #26
mpdonadioRead this in place, and it looks good. Think all feedback has been addressed. This is eligible for 8.1.x per the policy under "API documentation improvements."
Comment #27
alexpottCommitted 864055b and pushed to 8.1.x and 8.2.x. Thanks!