Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.

Commit 4212ff7

Browse files
committed
Rename anyDirectTasks to firstDirectTask for clarity and update related documentation
1 parent 2f3574b commit 4212ff7

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

basic.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ Caught exception: Error
944944
#### Task Race
945945

946946
Sometimes it's necessary to get the result of the fastest task from a set.
947-
The **`Scope::anyDirectTasks`** method returns a trigger
947+
The **`Scope::firstDirectTask`** method returns a trigger
948948
that fires as soon as at least one of the direct tasks in the **Scope** is completed.
949949

950950
**Example:**
@@ -960,7 +960,7 @@ function fetchDataFromApi(string ...$apiHosts): string
960960

961961
// Get the result of the fastest task
962962
// and cancel all other tasks
963-
return await $scope->anyDirectTasks();
963+
return await $scope->firstDirectTask();
964964
};
965965
}
966966

diagrams/decision-tree.puml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ spawn use($some): void {
2222
**[#87CEEB] You want to wait with cancellation?
2323
***[#lightgreen] Use await until: await $coroutine until $cancellation
2424
**[#87CEEB] Do you want to wait for at least one task (race)?
25-
***[#lightgreen] Use await + Scope::anyDirectTasks()
25+
***[#lightgreen] Use await + Scope::firstDirectTask()
2626
*[#lightblue] Do you need to cancel tasks?
2727
**[#87CEEB] Do you want to cancel a single coroutine?
2828
***[#lightgreen] Use Coroutine::cancel()

diagrams/decision-tree.svg

Lines changed: 1 addition & 1 deletion
Loading

diagrams/mind-map.puml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async inherit $scope {
2727
**[#FFD700] Waiting for direct child tasks
2828
***[#lightgreen] Scope::directTasks()
2929
**[#FFD700] Waiting for first direct child tasks (race)
30-
***[#lightgreen] Scope::anyDirectTasks()
30+
***[#lightgreen] Scope::firstDirectTask()
3131
**[#FFD700] Waiting with cancellation
3232
***[#lightgreen]: await + until
3333

diagrams/mind-map.svg

Lines changed: 1 addition & 1 deletion
Loading

examples/Async/Scope.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function cancel(?CancellationException $cancellationException = null): vo
2626

2727
public function directTasks(): Awaitable {}
2828

29-
public function anyDirectTasks(): Awaitable {}
29+
public function firstDirectTask(): Awaitable {}
3030

3131
public function allTasks(): Awaitable {}
3232

0 commit comments

Comments
 (0)