Skip to content

Commit

Permalink
Merge pull request #35 from seho-nl/master
Browse files Browse the repository at this point in the history
Use ResponseEvent instead of FilterResponseEvent to support Symfony 5
  • Loading branch information
eymengunay committed Oct 19, 2022
2 parents 3e32f92 + bfb91de commit 03fa80d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 0 additions & 1 deletion DependencyInjection/EoHoneypotExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Definition;

/**
* This is the class that loads and manages your bundle configuration
Expand Down
7 changes: 3 additions & 4 deletions EventListener/RedirectListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
use Eo\HoneypotBundle\Manager\HoneypotManager;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\HttpKernel;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\Routing\RouterInterface;

class RedirectListener
Expand All @@ -26,9 +25,9 @@ public function onBirdInCage()
$this->eventDispatcher->addListener('kernel.response', array($this, 'onKernelResponse'));
}

public function onKernelResponse(FilterResponseEvent $event)
public function onKernelResponse(ResponseEvent $event)
{
if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
if (!$event->isMainRequest()) {
return;
}

Expand Down
6 changes: 3 additions & 3 deletions Model/HoneypotPrey.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class HoneypotPrey implements HoneypotPreyInterface
protected $ip;

/**
* @var DateTime
* @var \DateTime
*/
protected $createdAt;

Expand Down Expand Up @@ -78,7 +78,7 @@ public function getIp()
/**
* Set createdAt
*
* @param DateTime $createdAt
* @param \DateTime $createdAt
* @return self
*/
public function setCreatedAt(\DateTime $createdAt)
Expand All @@ -91,7 +91,7 @@ public function setCreatedAt(\DateTime $createdAt)
/**
* Get createdAt
*
* @return DateTime $createdAt
* @return \DateTime $createdAt
*/
public function getCreatedAt()
{
Expand Down
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
"autoload": {
"psr-0": {
"Eo\\HoneypotBundle": ""
},
"psr-4": {
"Eo\\HoneypotBundle\\": ""
}
},
"extra": {
Expand Down

0 comments on commit 03fa80d

Please sign in to comment.