[wp-trac] [WordPress Trac] #46635: Improve identifying of non–trivial callbacks in hooks

WordPress Trac noreply at wordpress.org
Fri Aug 23 17:16:43 UTC 2024


#46635: Improve identifying of non–trivial callbacks in hooks
--------------------------------------+-------------------------------
 Reporter:  Rarst                     |       Owner:  (none)
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  General                   |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  coding-standards
--------------------------------------+-------------------------------

Comment (by jason_the_adams):

 I would also love to see this reach the finish line. I think your summary
 is good, @joehoyle. I an see issues in adding the 4th parameter that make
 backwards compatibility difficult, which leans me towards @schlessera's
 suggestion. I do acknowledge that the class-based route is a bit more
 complex, but I like the idea of encapsulating callbacks within an
 invokable class, which is something we often do anyway.

 The only change I'd make to the class approach would be to make
 `RemovableClass` both an interface (with more distinct properties/methods)
 _and_ a final class. That way folks could return a custom class that
 implements the interface and handles the callback.

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


More information about the wp-trac mailing list