php-decoratorsは必ずコールバックを受け取るのが最初ちょっとやっかいですね
https://github.com/AterCattus/php-decorators
<?php
namespace My{
function var_dump($func, $args) {
call_user_func_array('\var_dump', $args);
return function() use ($func) {
return call_user_func_array($func, func_get_args());
};
}
# @var_dump(func_get_args())
function test($name, $foo = null){
echo 'hello', PHP_EOL;
}
test('bar');
test('bar', 'baz');
}
出力は
string(3) "bar"
hello
string(3) "bar"
string(3) "baz"
hello