Issue
I'm following a Symfony tutorial and am currently on The Event Dispatcher section. In the first code block (after the composer part) I'm instructed to set up the dispatcher
// dispatch a response event
$this->dispatcher->dispatch(new ResponseEvent($response, $request), 'response');
I'm using PHPStorm, and when I create the ResponseEvent
class it is asking for 4 arguments
new ResponseEvent($kernel, $request, $requestType, $response)
While I could create a $kernel
element by importing the HttpKernelInterface
, I'm unsure if this is correct.
I also have no idea where to get the $requestType
from, since the ResponseEvent
class definition says that this should be of type int
and I only know of request types in string format (e.g. 'GET', 'POST' etc).
Here is the full file in case I have made a mistake elsewhere.
Solution
The tutorial that you are following wants you to use the Simplex
ResponseEvent
, that method signature is for the kernel ResponseEvent
At the top of your file you should see something like this:
use Symfony\Component\HttpKernel\Event\ResponseEvent;
Replace it with
use Simplex\ResponseEvent;
Answered By - TheGentleman
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.