8 autocomplete pass current value to function
The form value is automagically added as a query parameter so it is not necessary to pass the current value. This is accessible in the Request object. The controller class method should be:

public function autocomplete(\Symfony\Component\HttpFoundation\Request $request) {
  $value = $request-&gt;query-&gt;get('q');
}