Unexpected Error With Form Controller

This is going to be a stupid one but I’m going to blog about it anyway.

While setting up a new custom module for Drupal 8, I need to set up a form. Since I’ve done this many times before, I copied and pasted stuff from another module which worked.

While renaming things and putting things in the right spot, when I went to test the form I got the following error:

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

Google was completely useless! It seems I was the only one in history to get this.

Considering how fucking burnt out I am without having a break in more than a year, I completely missed it. The solution was so simple.

I guess I had renamed my file wrong in the /module_name/src/Form/ folder. After renaming everything again to bullshit, I found I guess that was my issue.

I’m filling this under silly mistakes that I hope I never make again! #stupidjanny