[wp-trac] [WordPress Trac] #39240: Add a generic return value function

WordPress Trac noreply at wordpress.org
Mon Dec 12 01:57:20 UTC 2016


#39240: Add a generic return value function
-------------------------+------------------------------
 Reporter:  fjarrett     |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:  trunk
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------

Comment (by rmccue):

 Since we're actively trying to remove `create_function` from core
 (#37082), -1 on the implementation here. You can use classes to avoid
 needing it, but I don't see that core has a real need for it.

 In 5.3+, `function () { return 42; }` is pretty short, or you can create
 your own wrapper pretty easily:

 {{{
 function __return( $value ) {
     return function () use ( $value ) {
         return $value;
     }
 }
 }}}

 IMO, there's no need for this in core, +1 for close.

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


More information about the wp-trac mailing list