diff --git a/Tests/Middleware/EventDispatchMiddlewareTest.php b/Tests/Middleware/EventDispatchMiddlewareTest.php index 4e8ddf0..5a4dec8 100644 --- a/Tests/Middleware/EventDispatchMiddlewareTest.php +++ b/Tests/Middleware/EventDispatchMiddlewareTest.php @@ -11,7 +11,7 @@ use Prophecy\Prophecy\ObjectProphecy; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; /** * Class EventDispatchMiddlewareTest diff --git a/composer.json b/composer.json index b54d36a..f2fc5a5 100644 --- a/composer.json +++ b/composer.json @@ -22,13 +22,13 @@ "require": { "php": "^7.0", "guzzlehttp/guzzle": "~6.0", - "symfony/dependency-injection": "~2.8|~3.0|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/event-dispatcher": "~2.8|~3.0|~4.0", - "symfony/http-kernel": "~2.8|~3.0|~4.0", - "symfony/serializer": "~2.8|~3.0|~4.0", - "symfony/property-access": "~2.8|~3.0|~4.0", - "symfony/monolog-bundle": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~2.8|~3.0|~4.0|~5.0", + "symfony/expression-language": "~2.8|~3.0|~4.0|~5.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0|~5.0", + "symfony/http-kernel": "~2.8|~3.0|~4.0|~5.0", + "symfony/serializer": "~2.8|~3.0|~4.0|~5.0", + "symfony/property-access": "~2.8|~3.0|~4.0|~5.0", + "symfony/monolog-bundle": "~2.8|~3.0", "psr/log": "~1.0" }, "require-dev": { diff --git a/src/DataCollector/RequestDataCollector.php b/src/DataCollector/RequestDataCollector.php index b1d7599..c5c326d 100644 --- a/src/DataCollector/RequestDataCollector.php +++ b/src/DataCollector/RequestDataCollector.php @@ -22,7 +22,7 @@ class RequestDataCollector extends DataCollector /** * {@inheritdoc}Adds the requests to the data array of the Data Collector */ - public function collect(Request $request, Response $response, \Exception $exception = null) + public function collect(Request $request, Response $response, \Throwable $exception = null) { $this->data['requests'] = $this->messages; } diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 5dcde78..eeddad6 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -33,8 +33,13 @@ public function __construct(string $alias) */ public function getConfigTreeBuilder() { - $builder = new TreeBuilder(); - $builder->root($this->alias) + $builder = new TreeBuilder($this->alias); + + $rootNode = method_exists($builder, 'getRootNode') + ? $builder->getRootNode() + : $builder->root($this->alias); + + $rootNode ->children() ->append($this->createClientsNode())->end() ->end(); @@ -49,8 +54,10 @@ public function getConfigTreeBuilder() */ private function createClientsNode() { - $builder = new TreeBuilder(); - $node = $builder->root('clients'); + $builder = new TreeBuilder('clients'); + $node = method_exists($builder, 'getRootNode') + ? $builder->getRootNode() + : $builder->root('clients'); $node ->useAttributeAsKey('name') diff --git a/src/Events/PostTransactionEvent.php b/src/Events/PostTransactionEvent.php index e4568af..e921f19 100644 --- a/src/Events/PostTransactionEvent.php +++ b/src/Events/PostTransactionEvent.php @@ -2,7 +2,7 @@ namespace Mapudo\Bundle\GuzzleBundle\Events; use Psr\Http\Message\ResponseInterface; -use Symfony\Component\EventDispatcher\Event; +use Symfony\Contracts\EventDispatcher\Event; /** * Class PreTransactionEvent diff --git a/src/Events/PreTransactionEvent.php b/src/Events/PreTransactionEvent.php index 0f32a1e..3d4bcec 100644 --- a/src/Events/PreTransactionEvent.php +++ b/src/Events/PreTransactionEvent.php @@ -2,7 +2,7 @@ namespace Mapudo\Bundle\GuzzleBundle\Events; use Psr\Http\Message\RequestInterface; -use Symfony\Component\EventDispatcher\Event; +use Symfony\Contracts\EventDispatcher\Event; /** * Class PreTransactionEvent diff --git a/src/Middleware/EventDispatchMiddleware.php b/src/Middleware/EventDispatchMiddleware.php index 2205461..43570b5 100644 --- a/src/Middleware/EventDispatchMiddleware.php +++ b/src/Middleware/EventDispatchMiddleware.php @@ -8,7 +8,7 @@ use Mapudo\Bundle\GuzzleBundle\Events\GuzzleTransactionEventListenerInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; /** * Class EventDispatchMiddleware @@ -55,8 +55,8 @@ public function dispatch(): Closure $this ->eventDispatcher ->dispatch( - GuzzleTransactionEventListenerInterface::EVENT_PRE_TRANSACTION, - $preTransactionEvent + $preTransactionEvent, + GuzzleTransactionEventListenerInterface::EVENT_PRE_TRANSACTION ); /** @var PromiseInterface $promise */ @@ -68,8 +68,8 @@ function (ResponseInterface $response) { $this ->eventDispatcher ->dispatch( - GuzzleTransactionEventListenerInterface::EVENT_POST_TRANSACTION, - $postTransactionEvent + $postTransactionEvent, + GuzzleTransactionEventListenerInterface::EVENT_POST_TRANSACTION ); return $postTransactionEvent->getTransaction();