v1.3.0
What's Changed
- pass as alternative to spread by @RobertWesner in #2
Full Changelog: v1.2.0...v1.3.0
New
pass()
Novara::Call::pass() re-scopes a value as parameter of a function call.
Passing allows returning the value from the internal call.
Novara::Call::pass(
MyService::calculateSomethingComplex('foo', 123, func_get_arg(0)),
fn () => someFunction(func_get_arg(0)) ?: anotherFunction(func_get_arg(0)),
)args()
This can be combined with passing or spreading.
// Reuse args through passing
return Novara::Call::pass(
Novara::Call::args(
[
'name',
'age',
],
func_get_args(),
),
fn () => 'Name: ' . func_get_arg(0)->name . '; Age: ' . func_get_arg(0)->age,
);