Skip to content

Commit

Permalink
Merge pull request #2 from pavog/socket-type
Browse files Browse the repository at this point in the history
Extract $socket from constructor property promotion
  • Loading branch information
matthi4s authored Oct 24, 2023
2 parents f424c37 + c626494 commit 9f34ecc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/Communication/Socket/Socket.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,21 @@
*/
class Socket implements SocketInterface, SelectableSocketInterface
{

/**
* @var resource
*/
protected mixed $socket;

/**
* @param resource|Socket $socket
*/
public function __construct(protected mixed $socket)
public function __construct(mixed $socket)
{
if ($this->socket instanceof Socket) {
$this->socket = $this->socket->getStream();
if ($socket instanceof Socket) {
$this->socket = $socket->getStream();
} else {
$this->socket = $socket;
}
stream_set_blocking($this->socket, false);
}
Expand Down

0 comments on commit 9f34ecc

Please sign in to comment.