Skip to content

Commit f4602de

Browse files
committed
Resolve implicit null deprecation in PHP 8.4
1 parent 5940b7f commit f4602de

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Server.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,11 @@ public function disconnect(Socket $client, string $message = ''): bool
286286
*
287287
* @param string $command Hook to listen for (e.g. HOOK_CONNECT, HOOK_INPUT, HOOK_DISCONNECT, HOOK_TIMEOUT)
288288
* @param Socket $client
289-
* @param string $input Message Sent along with the Trigger
289+
* @param string|null $input Message Sent along with the Trigger
290290
*
291291
* @return bool Whether or not to continue running the server (true: continue, false: shutdown)
292292
*/
293-
protected function triggerHooks(string $command, Socket $client, string $input = null): bool
293+
protected function triggerHooks(string $command, Socket $client, ?string $input = null): bool
294294
{
295295
if (isset($this->hooks[$command])) {
296296
foreach ($this->hooks[$command] as $callable) {

src/Socket.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -709,14 +709,14 @@ protected static function exceptionOnFalse(?SocketResource $resource, callable $
709709
* <p>The function <code>write()</code> writes to the socket from the given buffer.</p>
710710
*
711711
* @param string $buffer The buffer to be written.
712-
* @param ?int $length The optional parameter length can specify an alternate length of bytes written to the
712+
* @param int|null $length The optional parameter length can specify an alternate length of bytes written to the
713713
* socket. If this length is greater than the buffer length, it is silently truncated to the length of the buffer.
714714
*
715715
* @return int Returns the number of bytes successfully written to the socket.
716716
* @throws SocketException If there was a failure.
717717
*
718718
*/
719-
public function write(string $buffer, int $length = null): int
719+
public function write(string $buffer, ?int $length = null): int
720720
{
721721
if (null === $length) {
722722
$length = strlen($buffer);
@@ -753,13 +753,13 @@ public function write(string $buffer, int $length = null): int
753753
* <li><code>MSG_EOF</code> - Close the sender side of the socket and include an appropriate notification
754754
* of this at the end of the sent data. The sent data completes the transaction.</li>
755755
* <li><code>MSG_DONTROUTE</code> - Bypass routing, use direct interface.</li></ul></p>
756-
* @param int $length The number of bytes that will be sent to the remote host from buffer.
756+
* @param int|null $length The number of bytes that will be sent to the remote host from buffer.
757757
*
758758
* @return int Returns the number of bytes sent.
759759
* @throws SocketException If there was a failure.
760760
*
761761
*/
762-
public function send(string $buffer, int $flags = 0, int $length = null): int
762+
public function send(string $buffer, int $flags = 0, ?int $length = null): int
763763
{
764764
if (null === $length) {
765765
$length = strlen($buffer);

0 commit comments

Comments
 (0)