Skip to content

Commit 81be4d0

Browse files
committed
Fix multiple issues due to Hyperf/Utils repository deprecation
1 parent 7fe06bd commit 81be4d0

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/RequestContextProvider.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Qiutuleng\HyperfDumpServer;
66

7+
use Hyperf\Coroutine\Coroutine;
78
use Hyperf\HttpMessage\Uri\Uri;
89
use Hyperf\HttpServer\Request;
910
use Hyperf\HttpServer\Router\Dispatched;
@@ -25,7 +26,7 @@ class RequestContextProvider implements ContextProviderInterface
2526
/**
2627
* The variable cloner.
2728
*
28-
* @var \Symfony\Component\VarDumper\Cloner\VarCloner
29+
* @var VarCloner
2930
*/
3031
private $cloner;
3132

@@ -56,7 +57,7 @@ public function getContext(): ?array
5657
'uri' => $this->getUri(),
5758
'method' => $this->currentRequest->getMethod(),
5859
'controller' => $this->getController(),
59-
'identifier' => \Hyperf\Utils\Coroutine::inCoroutine()
60+
'identifier' => Coroutine::inCoroutine()
6061
? spl_object_hash(Context::get(ServerRequestInterface::class))
6162
: Str::random(), // TODO: 非协程模式下,暂时未找到合适的唯一对象,先用随机数代替,缺陷是每次都会执行$io->section
6263
];
@@ -92,7 +93,14 @@ protected function getController()
9293
$callback = $this->transformRouteArrayAction($callback);
9394
}
9495

95-
return $this->cloner->cloneVar(class_basename($callback));
96+
return $this->cloner->cloneVar(
97+
basename(
98+
str_replace(
99+
'\\',
100+
'/',
101+
(is_object($callback) ? get_class($callback) : $callback))
102+
)
103+
);
96104
}
97105

98106
protected function transformRouteArrayAction(array $action): string

0 commit comments

Comments
 (0)