WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 8 weeks ago

#42786 closed defect (bug) (fixed)

get_settings_errors() inline docs return should reflect the array in detail

Reported by: webdevmattcrom Owned by: SergeyBiryukov
Milestone: 5.6 Priority: normal
Severity: normal Version:
Component: Options, Meta APIs Keywords: has-patch
Focuses: docs Cc:

Description

The return array should be explained in better detail in the inline docs, both for the purpose of clarity for developers, and for DevHub purposes.

Here's the line in the code:
https://core.trac.wordpress.org/browser/tags/4.9/src/wp-admin/includes/template.php#L1440

Suggested return array:

@return array {
 *     @type string $setting    The setting that is throwing an error.
 *     @type string $code       Code of the error.
 *     @type string $message    Message of the error.
 *     @type string $type       Type of error.
 * }

I have a patch, but would like clarity on whether this is accurate first.

Attachments (2)

42786.diff (1.1 KB) - added by stevenlinx 3 years ago.
42786.2.diff (1.1 KB) - added by stevenlinx 3 years ago.

Download all attachments as: .zip

Change History (9)

#1 @webdevmattcrom
3 years ago

  • Focuses docs added

This ticket was mentioned in Slack in #core-docs by webdevmattcrom. View the logs.


3 years ago

@stevenlinx
3 years ago

@stevenlinx
3 years ago

#3 @stevenlinx
3 years ago

  • Keywords has-patch added

Agreed to clarify the inline doc; however, we should use the same descriptions as the inline doc of add_settings_error().

The function handles the same "@global array $wp_settings_errors"

The inline doc description for $wp_settings_errors in both add_settings_error() and get_settings_errors() is also the same.

line in the code:
https://core.trac.wordpress.org/browser/tags/4.9/src/wp-admin/includes/template.php#L1384

#4 @pento
21 months ago

  • Version trunk deleted

#5 @atachibana
10 months ago

@SergeyBiryukov Can I ask you to check this issue? I think this issue and patch make sense.

#6 @SergeyBiryukov
8 weeks ago

  • Component changed from General to Options, Meta APIs
  • Milestone changed from Awaiting Review to 5.6
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#7 @SergeyBiryukov
8 weeks ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 48760:

Docs: Document the return value of get_settings_errors() using hash notation.

Props stevenlinx, webdevmattcrom, atachibana.
Fixes #42786.

Note: See TracTickets for help on using tickets.