See https://www.drupal.org/project/drupal/issues/2933424#comment-12399710 and subsequent comments for background.
There are various places in core that use @see inside the description of a function @param. This is not correct, and causes issues on https://api.drupal.org. The correct method is to just use "See ..." (i.e. write it as a sentence) if the thing you're linking to is closely related to the @param in question. (Or, if it's more relevant for the entire function instead, then it should remain a @see but be moved to its own line in the main function docblock.)
core/lib/Drupal/Component/Datetime/DateTimePlus.php is an example of a file in core that has a lot of these violations, but there are others. It may be necessary to come up with a grep expression to look through core for more of them.
| Comment | File | Size | Author |
|---|---|---|---|
| #27 | 2940420-27.patch | 1.37 KB | neelam_wadhwani |
| #26 | 2940420-26.patch | 2.63 KB | neslee canil pinto |
| #19 | see-should-not-be-used-inside-param-2940420-19.patch | 2.63 KB | ankitjain28may |
| #17 | @see-should-not-be-used-inside-@param-2940420-17.patch | 2.63 KB | ankitjain28may |
| #16 | Screenshot from 2018-02-26 20-59-52.png | 69.26 KB | ankitjain28may |
Comments
Comment #2
David_Rothstein commentedNote also the related/broader issue: #2662208: Fix @see documentation in core
Comment #3
ioana apetri commentedFor DateTimePlus class I provide this patch.
Comment #4
David_Rothstein commentedLooks like a good start, although I think the last one is wrong since it's not part of a @param - it is just a regular @see at the end of the function documentation, so it should probably stay as is (that's what allows https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Component%21Date... to automatically display it in the "See also" section).
Also, for the ones that are changing, since they are now sentences they should end in a period and be part of the rest of the paragraph (not fully on their own lines).
Comment #5
ioana apetri commentedThanks for the review. I resolved the problems mentioned by you.
Comment #6
shashwat purav commentedComment #7
shubhangi1995Comment #8
shubhangi1995Hi @purav
The patch you applied is missing the last change which was earlier asked to change form see to @see.
I am attaching the patch with corrected @see annotations from #3 with corrections of #4.
Comment #9
shubhangi1995Comment #10
mohit1604 commented@shubhangi1995, Thanks for working on the issue. Patch should not be of .txt format.
Comment #11
shubhangi1995sorry i guess i missed it @mohitmalik thanks for pointing it out.
Comment #13
harsha012 commentedre -uploaded the patch
Comment #14
mohit1604 commented@shubhangi1995, in the last part of patch #3, the change from from @see to See was not required so it was corrected in patch #5.
Patch #5 did changes correctly as per comment #4
Comment #15
ankitjain28may commented@harsha012, The patch you submitted didn't fix all the @see to See
This is still left to be fixed.
Comment #16
ankitjain28may commented@shubhangi1995 Your patch #11 is failed to apply.
Comment #17
ankitjain28may commentedThis patch will fix the above stated problem.
Comment #19
ankitjain28may commentedComment #20
ankitjain28may commentedComment #21
chiranjeeb2410 commented@ankitjain28may, patch serves the purpose and applies cleanly. RTBC good to go.
Comment #22
alexpottThank you for your work on cleaning up Drupal core's code style!
In order to fix core coding standards in a maintainable way, all our coding standards issues should be done on a per-rule basis across all of core, rather than fixing standards in individual modules or files. We should also separate fixes where we need to write new documentation from fixes where we need to correct existing standards. This all should be done as part of #2571965: [meta] Fix PHP coding standards in core, stage 1. A good place to start is the child issues of #2572645: [Meta] Fix 'Drupal.Commenting.FunctionComment' coding standard.
For background information on why we usually will not commit coding standards fixes that aren't scoped in that way, see the core issue scope guidelines, especially the note about coding standards cleanups. That document also includes numerous suggestions for scoping issues including documentation coding standards cleanups.
Contributing to the overall plan above will help ensure that your fixes for core's coding standards remain in core the long term.
Comment #24
avpadernoComment #25
prabha1997 commentedI am able to apply patch for 8.6.x version. But I am not able to apply patch for 8.9.x
$ git apply -v see-should-not-be-used-inside-param-2940420-19.patch
Checking patch core/lib/Drupal/Component/Datetime/DateTimePlus.php...
error: while searching for:
* @param \DateTime $datetime
* A DateTime object.
* @param array $settings
* @see __construct()
*
* @return static
* A new DateTimePlus object.
error: patch failed: core/lib/Drupal/Component/Datetime/DateTimePlus.php:129
error: core/lib/Drupal/Component/Datetime/DateTimePlus.php: patch does not apply
Comment #26
neslee canil pintoComment #27
neelam_wadhwani commentedHello @Neslee Canil Pinto
I cant see any difference between patch 19 and patch 26.
Your patch got failed.
KIndly review updated patch.
Comment #29
quietone commentedThis needs work for the point raised by alexpott in #22 which makes this not a novice issue anymore.
Comment #31
quietone commentedThis was fixed as part of #2933424: English-specific links to php.net shouldn't be used in non-translatable strings. Closing as a duplicate.