Skip to content

Commit

Permalink
Merge pull request #48 from php-http/feature/remove-async
Browse files Browse the repository at this point in the history
Remove support for async extension
  • Loading branch information
joelwurtz authored Sep 22, 2020
2 parents 7770fd3 + d730acd commit d8a0c07
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 61 deletions.
10 changes: 2 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ cache:
- $HOME/.composer/cache

php:
- 7.1
- 7.2
- 7.3
- 7.4

env:
global:
Expand All @@ -22,18 +22,13 @@ branches:
matrix:
fast_finish: true
include:
- php: 7.1
- php: 7.2
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci"
- php: 7.2
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
- php: 7.3
env: USE_ASYNC=true

before_install:
- travis_retry composer self-update
- if [[ "$USE_ASYNC" = true ]]; then git clone https://github.com/concurrent-php/ext-async.git /tmp/async; fi
- if [[ "$USE_ASYNC" = true ]]; then cd /tmp/async && phpize && ./configure && sudo make install; fi
- if [[ "$USE_ASYNC" = true ]]; then echo "extension = async.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini && php -m && cd $TRAVIS_BUILD_DIR; fi

install:
- travis_retry composer update ${COMPOSER_FLAGS} --prefer-source --no-interaction --ignore-platform-reqs
Expand All @@ -44,7 +39,6 @@ before_script:
script:
- cd ./tests/server/ssl && ./generate.sh && pwd && ls -la && cd ../../../
- $TEST_COMMAND
- ./vendor/bin/phpunit tests/SocketClientFeatureTest.php --printer Http\\Client\\Tests\\FeatureTestListener || echo ""

after_success:
- if [[ "$COVERAGE" = true ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Change Log

## 2.0.0 (unreleased)
## 2.0.0

* Remove response and stream factory, use direct implementation of nyholm/psr7
* Async support with ext-async extension: see https://github.com/concurrent-php/ext-async
Expand All @@ -20,7 +20,7 @@
* `ConnectionException`
* `InvalidRequestException`
* `SSLConnectionException`

## 1.2.0

* Dropped PHP 5.4 support
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
"symfony/options-resolver": "^2.6 || ^3.0 || ^4.0 || ^5.0"
},
"require-dev": {
"concurrent-php/async-api": "dev-master",
"friendsofphp/php-cs-fixer": "^2.2",
"php-http/client-integration-tests": "dev-master",
"php-http/message": "^1.0",
"php-http/client-common": "^2.0"
},
"provide": {
"php-http/client-implementation": "1.0"
"php-http/client-implementation": "1.0",
"psr/http-client": "1.0"
},
"autoload": {
"psr-4": {
Expand Down
9 changes: 0 additions & 9 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ class Client implements HttpClient
'ssl_method' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT,
];

private $hasAsync;

/**
* Constructor.
*
Expand All @@ -52,8 +50,6 @@ class Client implements HttpClient
*/
public function __construct($config1 = [], $config2 = null, array $config = [])
{
$this->hasAsync = PHP_VERSION_ID >= 70300 && \extension_loaded('async');

if (\is_array($config1)) {
$this->config = $this->configure($config1);

Expand Down Expand Up @@ -171,7 +167,6 @@ protected function configure(array $config = [])
/**
* Return remote socket from the request.
*
*
* @throws InvalidRequestException When no remote can be determined from the request
*
* @return string
Expand All @@ -191,10 +186,6 @@ private function determineRemoteFromRequest(RequestInterface $request)
$endpoint = $request->getHeaderLine('Host');
}

if ($this->hasAsync) {
return sprintf('async-tcp://%s', $endpoint);
}

return sprintf('tcp://%s', $endpoint);
}
}
37 changes: 0 additions & 37 deletions tests/AsyncTest.php

This file was deleted.

2 changes: 1 addition & 1 deletion tests/SocketClientFeatureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Http\Client\Socket\Tests;

use Http\Client\Tests\HttpFeatureTest;
use Http\Client\Socket\Client as SocketHttpClient;
use Http\Client\Tests\HttpFeatureTest;
use Psr\Http\Client\ClientInterface;

class SocketClientFeatureTest extends HttpFeatureTest
Expand Down
2 changes: 1 addition & 1 deletion tests/SocketHttpAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Http\Client\Socket\Tests;

use Http\Client\Tests\HttpClientTest;
use Http\Client\Socket\Client as SocketHttpClient;
use Http\Client\Tests\HttpClientTest;
use Psr\Http\Client\ClientInterface;

class SocketHttpAdapterTest extends HttpClientTest
Expand Down
2 changes: 1 addition & 1 deletion tests/SocketHttpClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Http\Client\Socket\Tests;

use Http\Client\Common\HttpMethodsClient;
use Http\Message\MessageFactory\GuzzleMessageFactory;
use Http\Client\Socket\Client as SocketHttpClient;
use Http\Message\MessageFactory\GuzzleMessageFactory;

class SocketHttpClientTest extends BaseTestCase
{
Expand Down

0 comments on commit d8a0c07

Please sign in to comment.