8000 Merge pull request #537 from clue-labs/nullable-v1 · reactphp/http@c4855ce · GitHub
[go: up one dir, main page]

Skip to content

Commit c4855ce

Browse files
authored
Merge pull request #537 from clue-labs/nullable-v1
[1.x] Improve PHP 8.4+ support by avoiding implicitly nullable types
2 parents 8111281 + 88128ac commit c4855ce

File tree

5 files changed

+13
-15
lines changed

5 files changed

+13
-15
lines changed

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,18 @@
3131
"fig/http-message-util": "^1.1",
3232
"psr/http-message": "^1.0",
3333
"react/event-loop": "^1.2",
34-
"react/promise": "^3 || ^2.3 || ^1.2.1",
35-
"react/socket": "^1.12",
36-
"react/stream": "^1.2"
34+
"react/promise": "^3.2 || ^2.3 || ^1.2.1",
35+
"react/socket": "^1.16",
36+
"react/stream": "^1.4"
3737
},
3838
"require-dev": {
3939
"clue/http-proxy-react": "^1.8",
4040
"clue/reactphp-ssh-proxy": "^1.4",
4141
"clue/socks-react": "^1.4",
4242
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36",
43-
"react/async": "^4 || ^3 || ^2",
43+
"react/async": "^4.2 || ^3 || ^2",
4444
"react/promise-stream": "^1.4",
45-
"react/promise-timer": "^1.9"
45+
"react/promise-timer": "^1.11"
4646
},
4747
"autoload": {
4848
"psr-4": {

src/Browser.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use React\Http\Message\Request;
1111
use React\Http\Message\Uri;
1212
use React\Promise\PromiseInterface;
13+
use React\Socket\Connector;
1314
use React\Socket\ConnectorInterface;
1415
use React\Stream\ReadableStreamInterface;
1516
use InvalidArgumentException;
@@ -88,7 +89,7 @@ public function __construct($connector = null, $loop = null)
8889

8990
$loop = $loop ?: Loop::get();
9091
$this->transaction = new Transaction(
91-
Sender::createFromLoop($loop, $connector),
92+
Sender::createFromLoop($loop, $connector ?: new Connector(array(), $loop)),
9293
$loop
9394
);
9495
}

src/Io/Sender.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use React\Http\Client\Client as HttpClient;
99
use React\Promise\PromiseInterface;
1010
use React\Promise\Deferred;
11-
use React\Socket\Connector;
1211
use React\Socket\ConnectorInterface;
1312
use React\Stream\ReadableStreamInterface;
1413

@@ -48,12 +47,8 @@ class Sender
4847
* @param ConnectorInterface|null $connector
4948
* @return self
5049
*/
51-
public static function createFromLoop(LoopInterface $loop, ConnectorInterface $connector = null)
50+
public static function createFromLoop(LoopInterface $loop, ConnectorInterface $connector)
5251
{
53-
if ($connector === null) {
54-
$connector = new Connector(array(), $loop);
55-
}
56-
5752
return new self(new HttpClient(new ClientConnectionManager($connector, $loop)));
5853
}
5954

tests/Io/SenderTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ public function setUpLoop()
2828

2929
public function testCreateFromLoop()
3030
{
31-
$sender = Sender::createFromLoop($this->loop, null);
31+
$connector = $this->getMockBuilder('React\Socket\ConnectorInterface')->getMock();
32+
33+
$sender = Sender::createFromLoop($this->loop, $connector);
3234

3335
$this->assertInstanceOf('React\Http\Io\Sender', $sender);
3436
}

tests/Io/StreamingServerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function setUpConnectionMockAndSocket()
3232
}
3333

3434

35-
private function mockConnection(array $additionalMethods = null)
35+
private function mockConnection(array $additionalMethods = array())
3636
{
3737
$connection = $this->getMockBuilder('React\Socket\Connection')
3838
->disableOriginalConstructor()
@@ -49,7 +49,7 @@ private function mockConnection(array $additionalMethods = null)
4949
'getLocalAddress',
5050
'pipe'
5151
),
52-
(is_array($additionalMethods) ? $additionalMethods : array())
52+
$additionalMethods
5353
))
5454
->getMock();
5555

0 commit comments

Comments
 (0)
0