When upgrading to drupal 9 I got the following errors in my EventSubscribers:
drupal 9 must be an instance of Symfony\Component\HttpKernel\Event\ResponseEvent, instance of Symfony\Component\HttpKernel\Event\RequestEvent given
Fix the issue by
changing your getSubscribedEvents()
public static function getSubscribedEvents() {
$events[KernelEvents::RESPONSE][] = array('checkAuthStatus');
return $events;
}
On top of the file, use
use Symfony\Component\HttpKernel\Event\ResponseEvent;
Your response code change to:
/**
* @param \Symfony\Component\HttpKernel\Event\ResponseEvent $event
*/
public function checkAuthStatus(ResponseEvent $event) {
This error occurs due to a symphony upgrade from 4.4 to 5.