The following error occured to me in a custom controller:

TypeError: Argument 2 passed to Symfony\Component\HttpKernel\Event\FilterControllerEvent::__construct() must be callable, object given, called in /var/www/html/vendor/symfony/http-kernel/HttpKernel.php on line 145 in Symfony\Component\HttpKernel\Event\FilterControllerEvent->__construct() (line 24 of /var/www/html/vendor/symfony/http-kernel/Event/FilterControllerEvent.php).

Solution

Make sure you call the method inside the controller instead of only the controller. f.e.

_controller: '\Drupal\x\Controller\xController::render'
Tags