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

WordPress Trac noreply at wordpress.org
Wed Apr 3 19:33:52 UTC 2019


#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:               |     Focuses:  coding-standards
-------------------------+-------------------------------

Comment (by Rarst):

 Replying to [comment:10 azaozz]:
 > As there doesn't seem to be a good way to remove filters and actions
 where the callback is a closure for now, I think we should add a "Doing it
 wrong" warnings so all new plugin/theme developers are aware they are
 breaking the hooks API.
 >
 > If/when closures become "easily removable", we can remove the Doing it
 wrong warnings too.

 Are you going to forbid ''objects'' as well? Because there is no good way
 to remove them either, access to original instance is in no way
 guaranteed.

 There is nothing breaking whatsoever about using advanced callbacks. If
 there was such a concern then Hooks API should never have ''supported''
 advanced callbacks.

 Really I get that from core perspective closures are "new" and
 questionable. From perspective of last nine years of PHP development,
 including WordPress space, they are ''fine''.

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


More information about the wp-trac mailing list