Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Adapter/DTL/DTLArgumentResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public function resolveArguments(object $object, string $method, Message $messag
return [];
}

return $this->dtlArgumnetResolver->resolveArguments(get_class($object), $method, $message->params ?? []);
return $this->dtlArgumnetResolver->resolveArguments($object::class, $method, $message->params ?? []);
}
}
2 changes: 1 addition & 1 deletion lib/Core/Command/CommandDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private function addCommand(string $id, Command $invokable): void
if (!is_callable($invokable)) {
throw new RuntimeException(sprintf(
'Object "%s" is not invokable',
get_class($invokable)
$invokable::class
));
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Core/Diagnostics/AggregateDiagnosticsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ public function provideDiagnostics(TextDocumentItem $textDocument, CancellationT
$this->logger->debug(sprintf(
'Diagnostic finsihed in "%s" (%s)',
number_format(microtime(true) - $start, 2),
get_class($provider)
$provider::class
));
} catch (Throwable $throwable) {
$this->logger->error(sprintf(
'Diagnostic error from provider "%s": %s',
get_class($provider),
$provider::class,
$throwable->getMessage()
), [
'trace' => $throwable->getTraceAsString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function resolveArguments(object $object, string $method, Message $messag
if (!$reflection->hasMethod($method)) {
throw new CouldNotResolveArguments(sprintf(
'Class "%s" has no method "%s"',
get_class($object),
$object::class,
$method
));
}
Expand Down Expand Up @@ -60,15 +60,15 @@ public function resolveArguments(object $object, string $method, Message $messag

throw new CouldNotResolveArguments(sprintf(
'First argument of LSP class "%s" method "%s" must be the LSP param object, it is "%s"',
get_class($object),
$object::class,
$method,
$classFqn
));
}

throw new CouldNotResolveArguments(sprintf(
'Class "%s" method "%s" is not a language server protocol-accepting method',
get_class($object),
$object::class,
$method
));
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Core/Dispatcher/Factory/ClosureDispatcherFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function create(MessageTransmitter $transmitter, InitializeParams $initia
if (!$dispatcher instanceof Dispatcher) {
throw new RuntimeException(sprintf(
'Closure must return a "Dispatcher" instance got "%s"',
is_object($dispatcher) ? get_class($dispatcher) : gettype($dispatcher)
get_debug_type($dispatcher)
));
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Core/Handler/HandlerMethodResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function resolveHandlerMethod(Handler $handler, string $languageServerMet
if (!array_key_exists($languageServerMethod, $handlerMap)) {
throw new RuntimeException(sprintf(
'Resolved handler "%s" has not declared support for LSP method "%s", it declared support for "%s"',
get_class($handler),
$handler::class,
$languageServerMethod,
implode('", "', $handlerMap)
));
Expand All @@ -24,7 +24,7 @@ public function resolveHandlerMethod(Handler $handler, string $languageServerMet
if (!method_exists($handler, $method)) {
throw new RuntimeException(sprintf(
'Handler "%s" for method "%s" does not have the "%s" method defined, it has "%s"',
get_class($handler),
$handler::class,
$languageServerMethod,
$method,
implode('", "', get_class_methods($handler))
Expand Down
6 changes: 3 additions & 3 deletions lib/Core/Handler/HandlerMethodRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function dispatch(Message $request): Promise
) {
throw new RuntimeException(sprintf(
'Message must either be a Notification or a Request, got "%s"',
get_class($request)
$request::class
));
}

Expand All @@ -64,9 +64,9 @@ public function dispatch(Message $request): Promise
if (!$promise instanceof Promise) {
throw new RuntimeException(sprintf(
'Handler "%s:%s" must return instance of Amp\\Promise, got "%s"',
get_class($handler),
$handler::class,
$method,
is_object($promise) ? get_class($promise) : gettype($promise)
get_debug_type($promise)
));
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Core/Server/Initializer/RequestInitializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function provideInitializeParams(Message $request): InitializeParams
if (!$request instanceof RequestMessage) {
throw new RuntimeException(sprintf(
'First request must be a RequestMessage (to initialize), got "%s"',
get_class($request)
$request::class
));
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Core/Server/LanguageServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function address(): ?string
if (!$this->streamProvider instanceof SocketStreamProvider) {
throw new RuntimeException(sprintf(
'Cannot get address on non-socket stream provider, using "%s"',
get_class($this->streamProvider)
$this->streamProvider::class
));
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Core/Server/Transmitter/TestMessageTransmitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function shiftNotification(): ?NotificationMessage
if (!$message instanceof NotificationMessage) {
throw new RuntimeException(sprintf(
'Expected NotificationMessage, got "%s"',
get_class($message)
$message::class
));
}

Expand All @@ -73,7 +73,7 @@ public function shiftRequest(): ?RequestMessage
if (!$message instanceof RequestMessage) {
throw new RuntimeException(sprintf(
'Expected RequestMessage, got "%s"',
get_class($message)
$message::class
));
}

Expand Down
10 changes: 5 additions & 5 deletions lib/Core/Service/ServiceManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ public function start(string $serviceName): void
));
}

$this->logger->info(sprintf('Starting service: %s (%s)', $serviceName, get_class($provider)));
$this->logger->info(sprintf('Starting service: %s (%s)', $serviceName, $provider::class));

if (!method_exists($provider, $serviceName)) {
throw new RuntimeException(sprintf(
'Service provider "%s" has no service method "%s"',
get_class($provider),
$provider::class,
$serviceName
));
}
Expand All @@ -67,8 +67,8 @@ public function start(string $serviceName): void
if (!$promise instanceof Promise) {
throw new RuntimeException(sprintf(
'Service method "%s" must return a Promise, got "%s"',
get_class($provider) . '::' . $serviceName,
is_object($promise) ? get_class($promise) : gettype($promise)
$provider::class . '::' . $serviceName,
get_debug_type($promise)
));
}

Expand All @@ -78,7 +78,7 @@ public function start(string $serviceName): void
$this->logger->error(sprintf(
'Error in service "%s" "%s:%s": %s',
$serviceName,
get_class($provider),
$provider::class,
__FUNCTION__,
$error->getMessage()
));
Expand Down
4 changes: 2 additions & 2 deletions lib/Middleware/ErrorHandlingMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ public function process(Message $request, RequestHandler $handler): Promise
)
));
} catch (Throwable $error) {
$message = sprintf('Exception [%s] %s', get_class($error), $error->getMessage());
$message = sprintf('Exception [%s] %s', $error::class, $error->getMessage());
$this->logger->error(sprintf(
'Error when handling "%s" (%s): %s',
get_class($request),
$request::class,
json_encode($request),
$message
));
Expand Down
2 changes: 1 addition & 1 deletion lib/Test/LanguageServerTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function initialize(): InitializeResult
if (!$result instanceof InitializeResult) {
throw new RuntimeException(sprintf(
'Initialize did not return an InitializeResult, got "%s"',
is_object($result) ? get_class($result) : gettype($result)
get_debug_type($result)
));
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Test/ListenerProvider/RecordingListenerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function shift(string $type): object
throw new RuntimeException(sprintf(
'Expected event of type "%s" but got "%s"',
$type,
get_class($next)
$next::class
));
}

Expand Down
Loading