-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathscope.stub.php
More file actions
88 lines (65 loc) · 2.4 KB
/
scope.stub.php
File metadata and controls
88 lines (65 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
/** @generate-class-entries */
namespace Async;
interface ScopeProvider
{
public function provideScope(): ?Scope;
}
interface SpawnStrategy extends ScopeProvider
{
/**
* Called before a coroutine is spawned, before it is enqueued.
*
* @param Coroutine $coroutine The coroutine to be spawned.
* @param Scope $scope The Scope instance.
*
*/
public function beforeCoroutineEnqueue(Coroutine $coroutine, Scope $scope): array;
/**
* Called after a coroutine is spawned, enqueued.
*
* @param Coroutine $coroutine
* @param Scope $scope
*/
public function afterCoroutineEnqueue(Coroutine $coroutine, Scope $scope): void;
}
/**
* @strict-properties
* @not-serializable
*/
final class Scope implements ScopeProvider
{
/**
* Creates a new Scope that inherits from the specified one. If the parameter is not provided,
* the Scope inherits from the current one.
*
* @param Scope|null $parentScope
*
* @return Scope
*/
public static function inherit(?Scope $parentScope = null): Scope {}
#[\Override] public function provideScope(): Scope {}
public function __construct() {}
public function asNotSafely(): Scope {}
public function spawn(\Closure $callable, mixed ...$params): Coroutine {}
public function cancel(?AsyncCancellation $cancellationError = null): void {}
public function awaitCompletion(Awaitable $cancellation): void {}
public function awaitAfterCancellation(?callable $errorHandler = null, ?Awaitable $cancellation = null): void {}
public function isFinished(): bool {}
public function isClosed(): bool {}
public function isCancelled(): bool {}
/**
* Sets an error handler that is called when an exception is passed to the Scope from one of its child coroutines.
*/
public function setExceptionHandler(callable $exceptionHandler): void {}
/**
* Exception handler for child Scope.
* Setting this handler prevents the exception from propagating to the current Scope.
*/
public function setChildScopeExceptionHandler(callable $exceptionHandler): void {}
public function finally(\Closure $callback): void {}
public function dispose(): void {}
public function disposeSafely(): void {}
public function disposeAfterTimeout(int $timeout): void {}
public function getChildScopes(): array {}
}