Skip to content

Commit 1cc368e

Browse files
committed
Merge pull request #54 from clue-labs/php
First class support for PHP7 and HHVM
2 parents a14adf5 + 818fe1c commit 1cc368e

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

.travis.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,11 @@ php:
66
- 5.6
77
- 7
88
- hhvm
9-
- hhvm-nightly
109

11-
matrix:
12-
allow_failures:
13-
- php: 7
14-
- php: hhvm
15-
- php: hhvm-nightly
16-
fast_finish: true
10+
sudo: false
1711

18-
before_script:
19-
- composer install --dev --prefer-source
12+
install:
13+
- composer install --prefer-source --no-interaction
2014

2115
script:
2216
- phpunit --coverage-text

src/SecureConnector.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use React\EventLoop\LoopInterface;
66
use React\Stream\Stream;
7+
use React\Promise;
78

89
class SecureConnector implements ConnectorInterface
910
{
@@ -18,6 +19,10 @@ public function __construct(ConnectorInterface $connector, LoopInterface $loop)
1819

1920
public function create($host, $port)
2021
{
22+
if (!function_exists('stream_socket_enable_crypto')) {
23+
return Promise\reject(new \BadMethodCallException('Encryption not supported on your platform (HHVM < 3.8?)'));
24+
}
25+
2126
return $this->connector->create($host, $port)->then(function (Stream $stream) use ($host) {
2227
// (unencrypted) TCP/IP connection succeeded
2328

tests/IntegrationTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ public function gettingStuffFromGoogleShouldWork()
4242
/** @test */
4343
public function gettingEncryptedStuffFromGoogleShouldWork()
4444
{
45+
if (defined('HHVM_VERSION')) {
46+
$this->markTestSkipped('Not supported on HHVM');
47+
}
48+
4549
$loop = new StreamSelectLoop();
4650

4751
$factory = new Factory();

0 commit comments

Comments
 (0)