From 2e0537732336358844520e6f930fe04ba45651ba Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 28 Jun 2021 10:02:18 -0700 Subject: [PATCH] Fixes #5997 by intentionally sending Success response from shutdown method --- src/Psalm/Internal/LanguageServer/LanguageServer.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Psalm/Internal/LanguageServer/LanguageServer.php b/src/Psalm/Internal/LanguageServer/LanguageServer.php index ebc0e03c0f4..71f625ded29 100644 --- a/src/Psalm/Internal/LanguageServer/LanguageServer.php +++ b/src/Psalm/Internal/LanguageServer/LanguageServer.php @@ -395,8 +395,9 @@ function (IssueData $issue_data) : Diagnostic { * The shutdown request is sent from the client to the server. It asks the server to shut down, * but to not exit (otherwise the response might not be delivered correctly to the client). * There is a separate exit notification that asks the server to exit. + * @psalm-suppress PossiblyUnusedReturnValue */ - public function shutdown(): void + public function shutdown(): Promise { $this->clientStatus('closing'); $this->verboseLog("Shutting down..."); @@ -407,7 +408,7 @@ public function shutdown(): void $scanned_files ); $this->clientStatus('closed'); - new Success(null); + return new Success(null); } /** @@ -439,7 +440,6 @@ private function verboseLog(string $message, int $type = 4): void '[Psalm ' .PSALM_VERSION. ' - PHP Language Server] ' . $message, $type ); - return; } catch (\Throwable $err) { // do nothing } @@ -465,8 +465,9 @@ private function clientStatus(string $status, ?string $additional_info = null): 'telemetry/event' ); } catch (\Throwable $err) { - new Success(null); + // do nothing } + new Success(null); } /**