Make WordPress Core

Opened 4 months ago

Closed 3 months ago

#55799 closed enhancement (fixed)

Exclude PHP polyfill functions from code reference.

Reported by: dd32's profile dd32 Owned by:
Milestone: 6.1 Priority: low
Severity: minor Version:
Component: General Keywords: has-patch
Focuses: docs Cc:

Description

wp-includes/compat.php contains a number of PHP functions which may be 'missing' from installations, due to either being introduced in a later PHP version or being dependant upon extensions.

The following functions are @ignore'd which prevents them showing up on https://developer.wordpress.org/reference/files/wp-includes/compat.php/

  • mb_substr()
  • mb_strlen()
  • hash_hmac()
  • prefixed private variants of those functions

The following functions have compat methods defined, but do not include @ignore and appear on the above page as a result:

  • hash_equals()
  • is_countable()
  • is_iterable()
  • array_key_first()
  • array_key_last()
  • str_contains()
  • str_starts_with()
  • str_ends_with()
  • _() (single underscore, used by some external libraries)

Aside from the last one, _(), I don't see any reason for these to be included in the WordPress documentation reference.

These functions were added in WordPress 3.9.2, 4.9.6, and 5.9.0.

Attachments (1)

55799.diff (2.1 KB) - added by dd32 4 months ago.

Download all attachments as: .zip

Change History (4)

@dd32
4 months ago

#1 follow-up: @dd32
4 months ago

It did occur to me that we could probably just also exclude _() and ignore the entire file in the developer docs parser instead.

#2 @mukesh27
4 months ago

  • Milestone changed from Awaiting Review to 6.1

55799.diff look good to skipped when parsing.

Moving this ticket to the milestone for visibility.

#3 in reply to: ↑ 1 @SergeyBiryukov
3 months ago

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

Replying to dd32:

It did occur to me that we could probably just also exclude _() and ignore the entire file in the developer docs parser instead.

Makes sense to me, I went that route in [meta11956].

After deleting the previously imported entries and re-running the parser, these polyfill functions no longer show up in the Code Reference.

Note: See TracTickets for help on using tickets.