Skip to content

Commit f78ec36

Browse files
committed
Fix psalm errors
1 parent 35a771a commit f78ec36

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

‎examples/datagram.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
echo "Datagram active on {$datagram->getAddress()}" . PHP_EOL;
1515

16+
/** @psalm-suppress PossiblyNullArrayAccess */
1617
while ([$address, $data] = yield $datagram->receive()) {
1718
$message = \sprintf("Received '%s' from %s\n", \trim($data), (string) $address);
1819
$datagram->send($address, $message);

‎src/EncryptableSocket.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface EncryptableSocket extends Socket
1515
/**
1616
* @param CancellationToken|null $cancellationToken
1717
*
18-
* @return Promise<null> Resolved when TLS is successfully set up on the socket.
18+
* @return Promise<void> Resolved when TLS is successfully set up on the socket.
1919
*
2020
* @throws SocketException Promise fails and the socket is closed if setting up TLS fails.
2121
*/
@@ -24,7 +24,7 @@ public function setupTls(?CancellationToken $cancellationToken = null): Promise;
2424
/**
2525
* @param CancellationToken|null $cancellationToken
2626
*
27-
* @return Promise<null> Resolved when TLS is successfully shutdown.
27+
* @return Promise<void> Resolved when TLS is successfully shutdown.
2828
*
2929
* @throws SocketException Promise fails and the socket is closed if shutting down TLS fails.
3030
*/

‎src/Internal/functions.php‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function parseUri(string $uri): array
7272
* @param array $options
7373
* @param CancellationToken $cancellationToken
7474
*
75-
* @return Promise
75+
* @return Promise<void>
7676
*
7777
* @internal
7878
*/
@@ -90,7 +90,8 @@ function setupTls($socket, array $options, ?CancellationToken $cancellationToken
9090

9191
// Yes, that function can return true / false / 0, don't use weak comparisons.
9292
if ($result === true) {
93-
return new Success($socket);
93+
/** @psalm-suppress InvalidReturnStatement */
94+
return new Success;
9495
}
9596

9697
if ($result === false) {
@@ -142,16 +143,18 @@ function setupTls($socket, array $options, ?CancellationToken $cancellationToken
142143
*
143144
* @param resource $socket
144145
*
145-
* @return Promise
146+
* @return Promise<void>
146147
*
147148
* @internal
149+
* @psalm-suppress InvalidReturnType
148150
*/
149151
function shutdownTls($socket): Promise
150152
{
151153
// note that disabling crypto *ALWAYS* returns false, immediately
152154
// don't set _enabled to false, TLS can be setup only once
153155
@\stream_socket_enable_crypto($socket, false);
154156

157+
/** @psalm-suppress InvalidReturnStatement */
155158
return new Success;
156159
}
157160

0 commit comments

Comments
 (0)