Skip to content

Commit

Permalink
Merge bc21167 into d23cc5a
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Jun 11, 2019
2 parents d23cc5a + bc21167 commit 8d3db0b
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -19,7 +19,7 @@ cache:
env:
global:
- PATH="$HOME/.composer/vendor/bin:$PATH"
- SYMFONY_DEPRECATIONS_HELPER=weak_vendors
- SYMFONY_DEPRECATIONS_HELPER=max[self]=0
- TARGET=test

stages:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -25,7 +25,7 @@
"php-http/httplug-bundle": "^1.15",
"symfony/config": "^3.4 || ^4.2",
"symfony/dependency-injection": "^3.4 || ^4.2",
"symfony/event-dispatcher": "^3.4 || ^4.2",
"symfony/event-dispatcher-contracts": "^1.1",
"symfony/expression-language": "^3.4 || ^4.2",
"symfony/framework-bundle": "^3.4 || ^4.2",
"symfony/http-foundation": "^3.4 || ^4.2",
Expand Down
3 changes: 3 additions & 0 deletions phpstan.neon
Expand Up @@ -10,3 +10,6 @@ parameters:
ignoreErrors:
# Symfony DI
- '#Cannot call method scalarNode\(\) on Symfony\\Component\\Config\\Definition\\Builder\\NodeParentInterface\|null.#'

# Symfony Contracts
- '#Method Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface::dispatch\(\) invoked with 2 parameters, 1 required.#'
2 changes: 1 addition & 1 deletion phpunit.xml.dist
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" bootstrap="tests/bootstrap.php">
<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak_vendors"/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0"/>
</php>
<testsuites>
<testsuite name="LastFmBundle Test Suite">
Expand Down
4 changes: 2 additions & 2 deletions src/Action/AuthErrorAction.php
Expand Up @@ -14,11 +14,11 @@
use Core23\LastFmBundle\Core23LastFmEvents;
use Core23\LastFmBundle\Event\AuthFailedEvent;
use Core23\LastFmBundle\Session\SessionManagerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
Expand Down Expand Up @@ -80,7 +80,7 @@ public function __invoke(): Response
$this->sessionManager->clear();

$event = new AuthFailedEvent();
$this->eventDispatcher->dispatch(Core23LastFmEvents::AUTH_ERROR, $event);
$this->eventDispatcher->dispatch($event, Core23LastFmEvents::AUTH_ERROR);

if ($response = $event->getResponse()) {
return $response;
Expand Down
4 changes: 2 additions & 2 deletions src/Action/AuthSuccessAction.php
Expand Up @@ -14,11 +14,11 @@
use Core23\LastFmBundle\Core23LastFmEvents;
use Core23\LastFmBundle\Event\AuthSuccessEvent;
use Core23\LastFmBundle\Session\SessionManagerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
Expand Down Expand Up @@ -84,7 +84,7 @@ public function __invoke(): Response
}

$event = new AuthSuccessEvent($session);
$this->eventDispatcher->dispatch(Core23LastFmEvents::AUTH_SUCCESS, $event);
$this->eventDispatcher->dispatch($event, Core23LastFmEvents::AUTH_SUCCESS);

if ($response = $event->getResponse()) {
return $response;
Expand Down
1 change: 0 additions & 1 deletion src/Action/CheckAuthAction.php
Expand Up @@ -11,7 +11,6 @@

namespace Core23\LastFmBundle\Action;

use Core23\LastFm\Service\AuthService;
use Core23\LastFm\Service\AuthServiceInterface;
use Core23\LastFmBundle\Session\SessionManagerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
Expand Down
2 changes: 1 addition & 1 deletion src/Event/AuthFailedEvent.php
Expand Up @@ -11,8 +11,8 @@

namespace Core23\LastFmBundle\Event;

use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Contracts\EventDispatcher\Event;

final class AuthFailedEvent extends Event
{
Expand Down
2 changes: 1 addition & 1 deletion src/Event/AuthSuccessEvent.php
Expand Up @@ -12,8 +12,8 @@
namespace Core23\LastFmBundle\Event;

use Core23\LastFm\Session\SessionInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Contracts\EventDispatcher\Event;

final class AuthSuccessEvent extends Event
{
Expand Down
6 changes: 3 additions & 3 deletions tests/Action/AuthErrorActionTest.php
Expand Up @@ -15,11 +15,11 @@
use Core23\LastFmBundle\Session\SessionManagerInterface;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Twig\Environment;

class AuthErrorActionTest extends TestCase
Expand Down Expand Up @@ -50,7 +50,7 @@ public function testExecute(): void
->shouldBeCalled()
;

$this->eventDispatcher->dispatch(Core23LastFmEvents::AUTH_ERROR, Argument::type(AuthFailedEvent::class))
$this->eventDispatcher->dispatch(Argument::type(AuthFailedEvent::class), Core23LastFmEvents::AUTH_ERROR)
->shouldBeCalled()
;

Expand Down Expand Up @@ -79,7 +79,7 @@ public function testExecuteWithCaughtEvent(): void

$eventResponse = new Response();

$this->eventDispatcher->dispatch(Core23LastFmEvents::AUTH_ERROR, Argument::type(AuthFailedEvent::class))
$this->eventDispatcher->dispatch(Argument::type(AuthFailedEvent::class), Core23LastFmEvents::AUTH_ERROR)
->will(function ($args) use ($eventResponse) {
$args[1]->setResponse($eventResponse);
})
Expand Down
6 changes: 3 additions & 3 deletions tests/Action/AuthSuccessActionTest.php
Expand Up @@ -16,11 +16,11 @@
use Core23\LastFmBundle\Session\SessionManagerInterface;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Twig\Environment;

class AuthSuccessActionTest extends TestCase
Expand Down Expand Up @@ -55,7 +55,7 @@ public function testExecute(): void
->willReturn('FooUser')
;

$this->eventDispatcher->dispatch(Core23LastFmEvents::AUTH_SUCCESS, Argument::type(AuthSuccessEvent::class))
$this->eventDispatcher->dispatch(Argument::type(AuthSuccessEvent::class), Core23LastFmEvents::AUTH_SUCCESS)
->shouldBeCalled()
;

Expand Down Expand Up @@ -92,7 +92,7 @@ public function testExecuteWithCaughtEvent(): void

$eventResponse = new Response();

$this->eventDispatcher->dispatch(Core23LastFmEvents::AUTH_SUCCESS, Argument::type(AuthSuccessEvent::class))
$this->eventDispatcher->dispatch(Argument::type(AuthSuccessEvent::class), Core23LastFmEvents::AUTH_SUCCESS)
->will(function ($args) use ($eventResponse) {
$args[1]->setResponse($eventResponse);
})
Expand Down
2 changes: 1 addition & 1 deletion tests/Event/AuthFailedEventTest.php
Expand Up @@ -11,8 +11,8 @@

use Core23\LastFmBundle\Event\AuthFailedEvent;
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Contracts\EventDispatcher\Event;

class AuthFailedEventTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Event/AuthSuccessEventTest.php
Expand Up @@ -12,8 +12,8 @@
use Core23\LastFm\Session\SessionInterface;
use Core23\LastFmBundle\Event\AuthSuccessEvent;
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Contracts\EventDispatcher\Event;

class AuthSuccessEventTest extends TestCase
{
Expand Down

0 comments on commit 8d3db0b

Please sign in to comment.