1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Fix falsable issues with json_encode

This commit is contained in:
robchett 2023-10-09 22:11:00 +01:00
parent f6d4a98063
commit 276a25de92
3 changed files with 3 additions and 3 deletions

View File

@ -159,7 +159,7 @@ class LanguageClient
} }
/** @var array */ /** @var array */
$array = json_decode(json_encode($config), true); $array = json_decode((string) json_encode($config), true);
if (isset($array['hideWarnings'])) { if (isset($array['hideWarnings'])) {
$this->clientConfiguration->hideWarnings = (bool) $array['hideWarnings']; $this->clientConfiguration->hideWarnings = (bool) $array['hideWarnings'];

View File

@ -843,7 +843,7 @@ class LanguageServer extends Dispatcher
} }
if (!empty($context)) { if (!empty($context)) {
$message .= "\n" . json_encode($context, JSON_PRETTY_PRINT); $message .= "\n" . (string) json_encode($context, JSON_PRETTY_PRINT);
} }
try { try {
$this->client->logMessage( $this->client->logMessage(

View File

@ -350,7 +350,7 @@ class InternalCallMapHandlerTest extends TestCase
continue; continue;
} }
yield "$function: " . json_encode($entry) => [$function, $entry]; yield "$function: " . (string) json_encode($entry) => [$function, $entry];
} }
} }