This commit is contained in:
2025-07-11 14:51:53 +08:00
parent f533d3262b
commit c0f8133926
+2 -2
View File
@@ -19,7 +19,7 @@ class TaskExecute implements TaskInterface
*/ */
public function task(string $handler, mixed $data, int $dstWorkerId = -1, ?callable $finishFinishCallback = null): void public function task(string $handler, mixed $data, int $dstWorkerId = -1, ?callable $finishFinishCallback = null): void
{ {
$array = class_implements($handler, false); $array = class_implements($handler, true);
if (!in_array(OnTaskInterface::class, $array, true)) { if (!in_array(OnTaskInterface::class, $array, true)) {
throw new Exception('Task is not implement OnTaskInterface'); throw new Exception('Task is not implement OnTaskInterface');
} }
@@ -39,7 +39,7 @@ class TaskExecute implements TaskInterface
*/ */
public function taskWait(string $handler, mixed $data, float $timeout = 0.5, int $dstWorkerId = -1): mixed public function taskWait(string $handler, mixed $data, float $timeout = 0.5, int $dstWorkerId = -1): mixed
{ {
$array = class_implements($handler, false); $array = class_implements($handler, true);
if (!in_array(OnTaskInterface::class, $array, true)) { if (!in_array(OnTaskInterface::class, $array, true)) {
throw new Exception('Task is not implement OnTaskInterface'); throw new Exception('Task is not implement OnTaskInterface');
} }