Skip to content

Update httplug and related packages version #777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@ env:
- TEST_COMMAND="vendor/bin/phpunit --verbose --coverage-text"

php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3

matrix:
include:
- php: hhvm
dist: trusty
- php: 7.2
name: Backward compatibillity check
env: DEPENDENCIES="roave/backward-compatibility-check" TEST_COMMAND="./vendor/bin/roave-backward-compatibility-check"
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
}
],
"require": {
"php": "^5.6 || ^7.0",
"php": "^7.1",
"psr/http-message": "^1.0",
"psr/cache": "^1.0",
"php-http/httplug": "^1.1",
"php-http/httplug": "^2.0",
"php-http/discovery": "^1.0",
"php-http/client-implementation": "^1.0",
"php-http/client-common": "^1.6",
"php-http/client-common": "^2.0",
"php-http/cache-plugin": "^1.4"
},
"require-dev": {
"phpunit/phpunit": "^5.5 || ^6.0",
"php-http/guzzle6-adapter": "^1.0",
"php-http/guzzle6-adapter": "^2.0",
"php-http/mock-client": "^1.0",
"guzzlehttp/psr7": "^1.2",
"cache/array-adapter": "^0.4"
Expand Down
3 changes: 2 additions & 1 deletion lib/Github/HttpClient/Plugin/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Github\Client;
use Github\Exception\RuntimeException;
use Http\Client\Common\Plugin;
use Http\Promise\Promise;
use Psr\Http\Message\RequestInterface;

/**
Expand All @@ -28,7 +29,7 @@ public function __construct($tokenOrLogin, $password, $method)
/**
* {@inheritdoc}
*/
public function handleRequest(RequestInterface $request, callable $next, callable $first)
public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
{
switch ($this->method) {
case Client::AUTH_HTTP_PASSWORD:
Expand Down
3 changes: 2 additions & 1 deletion lib/Github/HttpClient/Plugin/GithubExceptionThrower.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Github\Exception\ValidationFailedException;
use Github\HttpClient\Message\ResponseMediator;
use Http\Client\Common\Plugin;
use Http\Promise\Promise;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;

Expand All @@ -21,7 +22,7 @@ class GithubExceptionThrower implements Plugin
/**
* {@inheritdoc}
*/
public function handleRequest(RequestInterface $request, callable $next, callable $first)
public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
{
return $next($request)->then(function (ResponseInterface $response) use ($request) {
if ($response->getStatusCode() < 400 || $response->getStatusCode() > 600) {
Expand Down
4 changes: 2 additions & 2 deletions lib/Github/HttpClient/Plugin/History.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Github\HttpClient\Plugin;

use Http\Client\Common\Plugin\Journal;
use Http\Client\Exception;
use Psr\Http\Client\ClientExceptionInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;

Expand Down Expand Up @@ -32,7 +32,7 @@ public function addSuccess(RequestInterface $request, ResponseInterface $respons
$this->lastResponse = $response;
}

public function addFailure(RequestInterface $request, Exception $exception)
public function addFailure(RequestInterface $request, ClientExceptionInterface $exception)
{
}
}
3 changes: 2 additions & 1 deletion lib/Github/HttpClient/Plugin/PathPrepend.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Github\HttpClient\Plugin;

use Http\Client\Common\Plugin;
use Http\Promise\Promise;
use Psr\Http\Message\RequestInterface;

/**
Expand All @@ -25,7 +26,7 @@ public function __construct($path)
/**
* {@inheritdoc}
*/
public function handleRequest(RequestInterface $request, callable $next, callable $first)
public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
{
$currentPath = $request->getUri()->getPath();
if (strpos($currentPath, $this->path) !== 0) {
Expand Down
5 changes: 2 additions & 3 deletions test/Github/Tests/Api/AbstractApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Github\Api\AbstractApi;
use GuzzleHttp\Psr7\Response;
use Http\Client\Common\HttpMethodsClientInterface;

class AbstractApiTest extends TestCase
{
Expand Down Expand Up @@ -213,9 +214,7 @@ protected function getClientMock()
protected function getHttpMethodsMock(array $methods = [])
{
$methods = array_merge(['sendRequest'], $methods);
$mock = $this->getMockBuilder(\Http\Client\Common\HttpMethodsClient::class)
->disableOriginalConstructor()
->setMethods($methods)
$mock = $this->getMockBuilder(HttpMethodsClientInterface::class)
->getMock();
$mock
->expects($this->any())
Expand Down
4 changes: 4 additions & 0 deletions test/Github/Tests/HttpClient/PathPrependTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use Github\HttpClient\Plugin\PathPrepend;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use Http\Promise\FulfilledPromise;
use PHPUnit\Framework\TestCase;

/**
Expand All @@ -22,6 +24,8 @@ public function testPathIsPrepended($uri, $expectedPath)
$newRequest = null;
$plugin->handleRequest($request, function ($request) use (&$newRequest) {
$newRequest = $request;

return new FulfilledPromise(new Response());
}, function () {
throw new \RuntimeException('Did not expect plugin to call first');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

use Github\Exception\ExceptionInterface;
use Github\HttpClient\Plugin\GithubExceptionThrower;
use GuzzleHttp\Promise\FulfilledPromise;
use GuzzleHttp\Psr7\Response;
use Http\Promise\FulfilledPromise;
use Http\Promise\Promise;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
Expand All @@ -25,11 +26,11 @@ public function testHandleRequest(ResponseInterface $response, ExceptionInterfac
/** @var RequestInterface $request */
$request = $this->getMockForAbstractClass(RequestInterface::class);

$promise = $this->getMockBuilder(FulfilledPromise::class)->disableOriginalConstructor()->getMock();
$promise = $this->getMockBuilder(Promise::class)->getMock();
$promise->expects($this->once())
->method('then')
->willReturnCallback(function ($callback) use ($response) {
return $callback($response);
return new FulfilledPromise($callback($response));
});

$plugin = new GithubExceptionThrower();
Expand Down