Skip to content

Commit

Permalink
Ignore PHPStan error properly
Browse files Browse the repository at this point in the history
I don't like using ignore-line because it silences _all_ errors that could appear on a line, which is a recipe for missing future bugs.
  • Loading branch information
dktapps committed Feb 13, 2023
1 parent 6f6d543 commit 26ed56f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/RakLibToUserThreadMessageReceiver.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function handle(ServerEventListener $listener) : bool{
$sessionId = Binary::readInt(substr($packet, $offset, 4));
$offset += 4;
$reason = ord($packet[$offset]);
$listener->onClientDisconnect($sessionId, $reason); // @phpstan-ignore-line
$listener->onClientDisconnect($sessionId, $reason);
}elseif($id === ITCProtocol::PACKET_ACK_NOTIFICATION){
$sessionId = Binary::readInt(substr($packet, $offset, 4));
$offset += 4;
Expand Down
7 changes: 3 additions & 4 deletions tests/phpstan/configs/baseline.neon
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$codepoint of function chr expects int, int\\|null given\\.$#"
message: "#^Parameter \\#2 \\$reason of method raklib\\\\server\\\\ServerEventListener\\:\\:onClientDisconnect\\(\\) expects 0\\|1\\|2\\|3\\|4, int\\<0, 255\\> given\\.$#"
count: 1
path: ../../../src/UserToRakLibThreadMessageSender.php
path: ../../../src/RakLibToUserThreadMessageReceiver.php

-
message: "#^Parameter \\#1 \\$ascii of function chr expects int, int\\|null given\\.$#"
message: "#^Parameter \\#1 \\$codepoint of function chr expects int, int\\|null given\\.$#"
count: 1
path: ../../../src/UserToRakLibThreadMessageSender.php

0 comments on commit 26ed56f

Please sign in to comment.