Skip to content
This repository was archived by the owner on Jan 11, 2026. It is now read-only.
Open
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
11 changes: 5 additions & 6 deletions php/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,19 @@ public static function register()
set_exception_handler('Peekmo\AtomAutocompletePhp\ErrorHandler::onException');
}

/**
* @throws ErrorException on any error.
*/
public static function onError($code, $message, $file, $line, $context)
{
throw new \ErrorException($message, $code, 1, $file, $line);
// call onException directly instead of throw'ing
// to work around https://bugs.php.net/bug.php?id=66216
self::onException(new \ErrorException($message, $code, 1, $file, $line));
}

/**
* Display uncaught exception in JSON.
*
* @param \Exception $exception
* @param \Throwable $exception
*/
public static function onException(\Exception $exception)
public static function onException(\Throwable $exception)
{
die(
json_encode(
Expand Down
2 changes: 1 addition & 1 deletion php/services/Tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ protected function getMethodArguments(ReflectionFunctionAbstract $function)
);

$result['return']['type'] = method_exists($function, 'getReturnType') && $function->hasReturnType() // PHP7
? $function->getReturnType()->__toString()
? (version_compare(PHP_VERSION, '7.1.0', '>=') ? $function->getReturnType()->getName() : $function->getReturnType()->__toString())
: $result['return']['type']
;

Expand Down