Skip to content

Commit

Permalink
Support common client 2.x (#293)
Browse files Browse the repository at this point in the history
* Show that we support 2.0 of plugins

* Use version bridge

* Use Traits

* better for testning unreleased stuff

* Test with phpunit 6.5

* Bugfix

* Make it easier for Composer to solve SAT
  • Loading branch information
Nyholm committed Dec 29, 2018
1 parent a8e2caf commit 599e7d4
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -10,7 +10,7 @@ cache:
env:
global:
- TEST_COMMAND="composer test"
- SYMFONY_PHPUNIT_VERSION="6.3"
- SYMFONY_PHPUNIT_VERSION="6.5"
- SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit"

branches:
Expand Down
8 changes: 4 additions & 4 deletions Collector/ProfileClient.php
Expand Up @@ -3,6 +3,7 @@
namespace Http\HttplugBundle\Collector;

use Http\Client\Common\FlexibleHttpClient;
use Http\Client\Common\VersionBridgeClient;
use Http\Client\Exception\HttpException;
use Http\Client\HttpAsyncClient;
use Http\Client\HttpClient;
Expand All @@ -21,6 +22,8 @@
*/
class ProfileClient implements HttpClient, HttpAsyncClient
{
use VersionBridgeClient;

/**
* @var HttpClient|HttpAsyncClient
*/
Expand Down Expand Up @@ -114,10 +117,7 @@ public function sendAsyncRequest(RequestInterface $request)
}
}

/**
* {@inheritdoc}
*/
public function sendRequest(RequestInterface $request)
protected function doSendRequest(RequestInterface $request)
{
$stack = $this->collector->getActiveStack();
if (null === $stack) {
Expand Down
7 changes: 3 additions & 4 deletions Collector/ProfilePlugin.php
Expand Up @@ -17,6 +17,8 @@
*/
class ProfilePlugin implements Plugin
{
use Plugin\VersionBridgePlugin;

/**
* @var Plugin
*/
Expand Down Expand Up @@ -44,10 +46,7 @@ public function __construct(Plugin $plugin, Collector $collector, Formatter $for
$this->formatter = $formatter;
}

/**
* {@inheritdoc}
*/
public function handleRequest(RequestInterface $request, callable $next, callable $first)
protected function doHandleRequest(RequestInterface $request, callable $next, callable $first)
{
$profile = new Profile(get_class($this->plugin));

Expand Down
7 changes: 3 additions & 4 deletions Collector/StackPlugin.php
Expand Up @@ -17,6 +17,8 @@
*/
class StackPlugin implements Plugin
{
use Plugin\VersionBridgePlugin;

/**
* @var Collector
*/
Expand Down Expand Up @@ -44,10 +46,7 @@ public function __construct(Collector $collector, Formatter $formatter, $client)
$this->client = $client;
}

/**
* {@inheritdoc}
*/
public function handleRequest(RequestInterface $request, callable $next, callable $first)
protected function doHandleRequest(RequestInterface $request, callable $next, callable $first)
{
$stack = new Stack($this->client, $this->formatter->formatRequest($request));

Expand Down
7 changes: 3 additions & 4 deletions Tests/Functional/ProfilingTest.php
Expand Up @@ -122,10 +122,9 @@ private function createClient(array $plugins, $clientName = 'Acme', array $clien

class ExceptionThrowerPlugin implements Plugin
{
/**
* {@inheritdoc}
*/
public function handleRequest(RequestInterface $request, callable $next, callable $first)
use Plugin\VersionBridgePlugin;

protected function doHandleRequest(RequestInterface $request, callable $next, callable $first)
{
throw new \Exception();
}
Expand Down
40 changes: 21 additions & 19 deletions composer.json
Expand Up @@ -17,22 +17,22 @@
],
"require": {
"php": "^5.5 || ^7.0",
"php-http/client-common": "^1.6 || ^2.0",
"php-http/client-common": "^1.9 || ^2.0",
"php-http/client-implementation": "^1.0",
"php-http/cache-plugin": "^1.4",
"php-http/cache-plugin": "^1.6",
"php-http/discovery": "^1.0",
"php-http/httplug": "^1.0 || ^2.0",
"php-http/logger-plugin": "^1.0",
"php-http/logger-plugin": "^1.1",
"php-http/message": "^1.4",
"php-http/message-factory": "^1.0.2",
"php-http/stopwatch-plugin": "^1.0",
"php-http/stopwatch-plugin": "^1.2",
"psr/http-message": "^1.0",
"symfony/config": "^2.8 || ^3.0 || ^4.0",
"symfony/dependency-injection": "^2.8.3 || ^3.0.3 || ^4.0",
"symfony/event-dispatcher": "^2.8 || ^3.0 || ^4.0",
"symfony/http-kernel": "^2.8 || ^3.0 || ^4.0",
"symfony/options-resolver": "^2.8 || ^3.0 || ^4.0",
"twig/twig": "^1.18 || ^2.0"
"symfony/config": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/dependency-injection": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/event-dispatcher": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/http-kernel": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/options-resolver": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"twig/twig": "^1.36 || ^2.6"
},
"require-dev": {
"guzzlehttp/psr7": "^1.0",
Expand All @@ -46,15 +46,15 @@
"php-http/react-adapter": "^0.2.1",
"php-http/socket-client": "^1.0",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"symfony/browser-kit": "^2.8 || ^3.0 || ^4.0",
"symfony/cache": "^3.1 || ^4.0",
"symfony/dom-crawler": "^2.8 || ^3.0 || ^4.0",
"symfony/browser-kit": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/cache": "^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/dom-crawler": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/framework-bundle": "^2.8.1 || ^3.0.1 || ^4.0",
"symfony/http-foundation": "^2.8 || ^3.0 || ^4.0",
"symfony/phpunit-bridge": "^3.3 || ^4.0",
"symfony/stopwatch": "^2.8 || ^3.0 || ^4.0",
"symfony/twig-bundle": "^2.8 || ^3.0 || ^4.0",
"symfony/web-profiler-bundle": "^2.8 || ^3.0 || ^4.0"
"symfony/http-foundation": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/phpunit-bridge": "^3.4 || ^4.2",
"symfony/stopwatch": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/twig-bundle": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
"symfony/web-profiler-bundle": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1"
},
"conflict": {
"php-http/guzzle6-adapter": "<1.1"
Expand Down Expand Up @@ -83,5 +83,7 @@
"branch-alias": {
"dev-master": "1.x-dev"
}
}
},
"prefer-stable": true,
"minimum-stability": "dev"
}

0 comments on commit 599e7d4

Please sign in to comment.