- $args = array_map( function ( $value ) {
- if ( is_object( $value ) && $value instanceof Closure ) {
- // If an argument is a Closure, call it.
- return $value();
- } else {
- return $value;
- }
- }, $args );
+ if ( !isset( $spec['closure_expansion'] ) ||
+ $spec['closure_expansion'] === true
+ ) {
+ $args = array_map( function ( $value ) {
+ if ( is_object( $value ) && $value instanceof Closure ) {
+ // If an argument is a Closure, call it.
+ return $value();
+ } else {
+ return $value;
+ }
+ }, $args );
+ }