Make WordPress Core

Opened 5 weeks ago

Closed 5 weeks ago

#63511 closed defect (bug) (fixed)

Adjust deprecation note in WP_Community_Events::format_event_data_time()

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.9 Priority: normal
Severity: normal Version: 5.5.2
Component: Administration Keywords: good-first-bug has-patch dev-feedback
Focuses: Cc:

Description (last modified by SergeyBiryukov)

There's a function call in WP_Community_Events::format_event_data_time():

_deprecated_function(
	__METHOD__,
	'5.5.2',
	'This is no longer used by core, and only kept for backward compatibility.'
);

However, _deprecated_function() does not support a custom string like that, so what this actually displays is:

Deprecated: Function format_event_data_time is <strong>deprecated</strong> since version 5.5.2! Use This is no longer used by core, and only kept for backward compatibility. instead.

Since the DocBlock already mentions that the method is unused:

@deprecated 5.6.0 No longer used in core.

I think we can just remove the third argument so that the default deprecation message is used:

Deprecated: Function format_event_data_time is <strong>deprecated</strong> since version 5.5.2 with no alternative available.

That would also be consistent with the ::maybe_log_events_response() method in the same class.

Alternatively, _doing_it_wrong() can be used instead, which does support a custom message.

Introduced in [49146].

Attachments (1)

63511.patch (751 bytes) - added by dhruvang21 5 weeks ago.

Download all attachments as: .zip

Change History (7)

#1 @SergeyBiryukov
5 weeks ago

  • Description modified (diff)

This ticket was mentioned in PR #8877 on WordPress/wordpress-develop by @dhruvik18.


5 weeks ago
#2

  • Keywords has-patch added; needs-patch removed

In this PR Refactored the deprecated function call to use _doing_it_wrong() for better clarity and compatibility in WP_Community_Events::format_event_data_time()

Trac ticket: https://core.trac.wordpress.org/ticket/63511

#3 follow-up: @rollybueno
5 weeks ago

  • Keywords needs-patch added; has-patch removed

If we use _doing_it_wrong(), wouldn't it be considered as having alternative?

@dhruvang21
5 weeks ago

#4 @dhruvang21
5 weeks ago

  • Keywords has-patch added; needs-patch removed

#5 in reply to: ↑ 3 @SirLouen
5 weeks ago

  • Keywords dev-feedback added

Replying to rollybueno:

If we use _doing_it_wrong(), wouldn't it be considered as having alternative?

Replying to SergeyBiryukov:

Alternatively, _doing_it_wrong() can be used instead, which does support a custom message.

doing_it_wrong doesn't fit here.

And the deprecation informational text is 100% redundant, as the deprecation message is self-explanatory. It can be cleared with 0 trouble.

This can be shipped.

#6 @SergeyBiryukov
5 weeks ago

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

In 60273:

General: Adjust WP_Community_Events::format_event_data_time() deprecation.

_deprecated_function() does not support a custom message, which appears to be redundant here, as the method's DocBlock already indicates that it is unused as of WordPress 5.5.2.

Includes correcting the version in the @deprecated tag.

Follow-up to [49146], [49201].

Props dhruvik18, dhruvang21, rollybueno, SirLouen, SergeyBiryukov.
Fixes #63511.

Note: See TracTickets for help on using tickets.