Skip to content

Commit

Permalink
Drop error suppression
Browse files Browse the repository at this point in the history
  • Loading branch information
kelunik committed Jun 25, 2020
1 parent 75321ab commit b9064b9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/DatagramSocket.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public function send(SocketAddress $address, string $data): Promise
throw new SocketException(\sprintf('Could not send packet on endpoint: %s', $errstr));
});

$result = @\stream_socket_sendto($this->socket, $data, 0, $address->toString());
$result = \stream_socket_sendto($this->socket, $data, 0, $address->toString());
/** @psalm-suppress TypeDoesNotContainType */
if ($result < 0 || $result === false) {
throw new SocketException('Could not send packet on endpoint: Unknown error');
Expand Down
4 changes: 2 additions & 2 deletions src/Internal/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function setupTls($socket, array $options, ?CancellationToken $cancellationToken
new TlsException('TLS negotiation failed: ' . $errstr);
});

$result = @\stream_socket_enable_crypto($socket, $enable = true);
$result = \stream_socket_enable_crypto($socket, $enable = true);
if ($result === false) {
throw new TlsException('TLS negotiation failed: Unknown error');
}
Expand Down Expand Up @@ -134,7 +134,7 @@ function setupTls($socket, array $options, ?CancellationToken $cancellationToken
throw new TlsException('TLS negotiation failed: ' . $errstr);
});

$result = @\stream_socket_enable_crypto($socket, true);
$result = \stream_socket_enable_crypto($socket, true);
if ($result === false) {
$message = \feof($socket) ? 'Connection reset by peer' : 'Unknown error';
throw new TlsException('TLS negotiation failed: ' . $message);
Expand Down
2 changes: 1 addition & 1 deletion src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function createPair(): array
throw new SocketException(\sprintf('Failed to create socket pair. Errno: %d; %s', $errno, $errstr));
});

$sockets = @\stream_socket_pair(\stripos(PHP_OS, 'win') === 0 ? STREAM_PF_INET : STREAM_PF_UNIX, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP);
$sockets = \stream_socket_pair(\stripos(PHP_OS, 'win') === 0 ? STREAM_PF_INET : STREAM_PF_UNIX, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP);
if ($sockets === false) {
throw new SocketException('Failed to create socket pair.');
}
Expand Down

0 comments on commit b9064b9

Please sign in to comment.