Skip to content

v1.3.0

Choose a tag to compare

@RobertWesner RobertWesner released this 12 Oct 09:58
· 9 commits to main since this release
0e4212d

What's Changed

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,
);