[wp-trac] [WordPress Trac] #63511: Adjust deprecation note in WP_Community_Events::format_event_data_time()

WordPress Trac noreply at wordpress.org
Mon Jun 2 09:41:50 UTC 2025


#63511: Adjust deprecation note in WP_Community_Events::format_event_data_time()
----------------------------------------+---------------------
 Reporter:  SergeyBiryukov              |       Owner:  (none)
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  6.9
Component:  Administration              |     Version:  5.5.2
 Severity:  normal                      |  Resolution:
 Keywords:  needs-patch good-first-bug  |     Focuses:
----------------------------------------+---------------------
Description changed by SergeyBiryukov:

Old description:

> 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 test 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 [source:tags/6.8.1/src/wp-
> admin/includes/class-wp-community-events.php?marks=515#L504
> ::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].

New description:

 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 [source:tags/6.8.1/src/wp-
 admin/includes/class-wp-community-events.php?marks=515#L504
 ::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].

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63511#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list