Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Tests/Middleware/EventDispatchMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion src/DataCollector/RequestDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
15 changes: 11 additions & 4 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion src/Events/PostTransactionEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Events/PreTransactionEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/Middleware/EventDispatchMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -55,8 +55,8 @@ public function dispatch(): Closure
$this
->eventDispatcher
->dispatch(
GuzzleTransactionEventListenerInterface::EVENT_PRE_TRANSACTION,
$preTransactionEvent
$preTransactionEvent,
GuzzleTransactionEventListenerInterface::EVENT_PRE_TRANSACTION
);

/** @var PromiseInterface $promise */
Expand All @@ -68,8 +68,8 @@ function (ResponseInterface $response) {
$this
->eventDispatcher
->dispatch(
GuzzleTransactionEventListenerInterface::EVENT_POST_TRANSACTION,
$postTransactionEvent
$postTransactionEvent,
GuzzleTransactionEventListenerInterface::EVENT_POST_TRANSACTION
);

return $postTransactionEvent->getTransaction();
Expand Down