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.

Comments

David_Rothstein created an issue. See original summary.

David_Rothstein’s picture

Note also the related/broader issue: #2662208: Fix @see documentation in core

ioana apetri’s picture

For DateTimePlus class I provide this patch.

David_Rothstein’s picture

Status: Active » Needs work

Looks 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).

ioana apetri’s picture

StatusFileSize
new2.89 KB

Thanks for the review. I resolved the problems mentioned by you.

shashwat purav’s picture

Status: Needs work » Needs review
shubhangi1995’s picture

Assigned: Unassigned » shubhangi1995
shubhangi1995’s picture

Hi @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.

shubhangi1995’s picture

Assigned: shubhangi1995 » Unassigned
mohit1604’s picture

@shubhangi1995, Thanks for working on the issue. Patch should not be of .txt format.

shubhangi1995’s picture

sorry i guess i missed it @mohitmalik thanks for pointing it out.

Status: Needs review » Needs work

The last submitted patch, 11: documentation-see_annotation-2940420-D8.patch, failed testing. View results

harsha012’s picture

Status: Needs work » Needs review
StatusFileSize
new2.42 KB

re -uploaded the patch

mohit1604’s picture

@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.

@@ -486,7 +486,7 @@ protected function prepareFormat($format) {
    * PHP creates a valid date from invalid data with only a warning,
    * 2011-02-30 becomes 2011-03-03, for instance, but we don't want that.
    *
-   * @see http://php.net/manual/time.getlasterrors.php
+   * See http://php.net/manual/time.getlasterrors.php

Patch #5 did changes correctly as per comment #4

ankitjain28may’s picture

@harsha012, The patch you submitted didn't fix all the @see to See

+++ b/core/lib/Drupal/Component/Datetime/DateTimePlus.php
@@ -212,9 +212,9 @@ public static function createFromTimestamp($timestamp, $timezone = NULL, $settin
    *   @see http://php.net/manual/datetime.createfromformat.php

This is still left to be fixed.

ankitjain28may’s picture

StatusFileSize
new69.26 KB

@shubhangi1995 Your patch #11 is failed to apply.

ankitjain28may’s picture

This patch will fix the above stated problem.

Status: Needs review » Needs work
ankitjain28may’s picture

ankitjain28may’s picture

Status: Needs work » Needs review
chiranjeeb2410’s picture

Status: Needs review » Reviewed & tested by the community

@ankitjain28may, patch serves the purpose and applies cleanly. RTBC good to go.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Thank 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.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

avpaderno’s picture

Version: 8.6.x-dev » 8.9.x-dev
prabha1997’s picture

I 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

neslee canil pinto’s picture

Status: Needs work » Needs review
StatusFileSize
new2.63 KB
neelam_wadhwani’s picture

StatusFileSize
new1.37 KB

Hello @Neslee Canil Pinto

I cant see any difference between patch 19 and patch 26.
Your patch got failed.

KIndly review updated patch.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

quietone’s picture

Status: Needs review » Needs work
Issue tags: -Novice

This needs work for the point raised by alexpott in #22 which makes this not a novice issue anymore.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

quietone’s picture

Category: Bug report » Task
Status: Needs work » Closed (duplicate)
Related issues: +#2933424: English-specific links to php.net shouldn't be used in non-translatable strings