Skip to content

Commit 9f34ecc

Browse files
authored
Merge pull request #2 from pavog/socket-type
Extract $socket from constructor property promotion
2 parents f424c37 + c626494 commit 9f34ecc

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/Communication/Socket/Socket.php

+11-3
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,21 @@
1616
*/
1717
class Socket implements SocketInterface, SelectableSocketInterface
1818
{
19+
20+
/**
21+
* @var resource
22+
*/
23+
protected mixed $socket;
24+
1925
/**
2026
* @param resource|Socket $socket
2127
*/
22-
public function __construct(protected mixed $socket)
28+
public function __construct(mixed $socket)
2329
{
24-
if ($this->socket instanceof Socket) {
25-
$this->socket = $this->socket->getStream();
30+
if ($socket instanceof Socket) {
31+
$this->socket = $socket->getStream();
32+
} else {
33+
$this->socket = $socket;
2634
}
2735
stream_set_blocking($this->socket, false);
2836
}

0 commit comments

Comments
 (0)