How to properly auto wire an Interface in Symfony 4.3.x when the method requires parameters?
You still want to create a closure to pass to $server->on
. You can do as such with:
$onRequest = Closure::fromCallable([$this->callback, 'request']);
and then pass it:
$server->on('request', $onRequest);
You are invoking the function where you want to pass reference to the function instead. Try this:
$server->on('request', function ($request, $response) {$this->callback->request($request, $response);});