hookphp icon indicating copy to clipboard operation
hookphp copied to clipboard

Simplify callback arguments?

Open pwFoo opened this issue 6 years ago • 0 comments

I don't know if it would be easy to do, but would be great if we don't need to write all the default arguments to a hook?

Would it possible to move the arguments to the class instead to repeat in the users code?

[...] function(&$arguments, $name, &$object, &$function, &$data)

I don't know if possible in that context. but maybe it's possible to inject the original method arguments / data by "use" behind the function () use [...] in Hook.php or build a single object like $event with all the data?

$event->object // original object
$event->arguments() // all arguments
$event->arguments(0) // first argument
$event->arguments('name') // argument by name
[...]

pwFoo avatar Dec 31 '19 21:12 pwFoo