Подскажите, почему сыпится ошибка при перебрасывании сервиса в параметры контроллера?
use App\Service\CustomService;
// где "...." - в этом месте еще куча разных сервисов подключаются, но они работают
public function index(...., CustomService $customService): Response
{
$telegramBot = new \TelegramBot\Api\Client($bot->getToken());
// logic
$telegramBot->on(function (\TelegramBot\Api\Types\Update $update) use ($telegramBot, $customService) {
$customService->customMethod(
$parametr1 = '...',
$parametr2 = '...',
$parametr3 = '...',
);
}, function () {
return true;
});
}
и вот что говорит:
request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "App\Controller\TestController::index()" requires that you provide a value for the "$customService" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /var/www/project/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 80 {"exception":"[object] (RuntimeException(code: 0): Controller \"App\\Controller\\TestController::index()\" requires that you provide a value for the \"$customService\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /var/www/maracuna/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:80)"} []
Как это пофиксить?