Make WordPress Core

#58348 closed defect (bug) (invalid)

API Doc: replace wrong string[] type with correct one - array

Reported by: platonkristinin's profile platonkristinin Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.3
Component: General Keywords: has-patch
Focuses: docs Cc:

Description

Wordpress API docs have a lot of places where string[] type is present. PHP doesn't support such data type. This lead into confusions and errors. The "string[]" data type should replaced with "array" data type.

Example:

wp_check_filetype( string $filename, string[] $mimes = null ): array

Fixed:

wp_check_filetype( string $filename, array $mimes = null ): array

Attachments (1)

58348.patch (1.1 KB) - added by pkbhatt 13 months ago.
Patch for the ticket 58348

Download all attachments as: .zip

Change History (5)

#1 @platonkristinin
13 months ago

If array argument can be null then function signature should look following:

wp_check_filetype( string $filename, array|null $mimes = null ): array

@pkbhatt
13 months ago

Patch for the ticket 58348

#2 @pkbhatt
13 months ago

  • Keywords has-patch added

Thanks for the ticket . I have applied patch as per your suggestion .

#3 @pkbhatt
13 months ago

  • Focuses docs added

#4 @johnbillion
13 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Thanks for the ticket. This is phpDoc array type notation, see the "Arrays" section on https://docs.phpdoc.org/2.9/references/phpdoc/types.html#arrays for all the details.

Note: See TracTickets for help on using tickets.