Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc(async): add documentation #386

Merged
merged 1 commit into from
Jan 5, 2023
Merged
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
7 changes: 6 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
Any edits to it will likely be lost.
-->

# Components

* [Psl\Async](../src/Psl/Async/README.md)

---

# Components API

- [Psl](./component/psl.md)
- [Psl\Async](./component/async.md)
- [Psl\Channel](./component/channel.md)
- [Psl\Class](./component/class.md)
- [Psl\Collection](./component/collection.md)
Expand Down
36 changes: 0 additions & 36 deletions docs/component/async.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/documenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ function get_all_components(): array
{
$components = [
'Psl',
'Psl\\Async',
'Psl\\Channel',
'Psl\\Class',
'Psl\\Collection',
Expand Down
6 changes: 6 additions & 0 deletions docs/templates/README.template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
Any edits to it will likely be lost.
-->

# Components

* [Psl\Async](../src/Psl/Async/README.md)

---

# Components API

{{ list }}
3 changes: 1 addition & 2 deletions src/Psl/Async/Awaitable.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(State $state)
}

/**
* Iterate over the given awaitables in completion order.
* Iterate over the given `Awaitable`s in completion order.
*
* @template Tk
* @template Tv
Expand Down Expand Up @@ -125,7 +125,6 @@ public function isComplete(): bool
return $this->state->isComplete();
}


/**
* {@inheritDoc}
*
Expand Down
9 changes: 5 additions & 4 deletions src/Psl/Async/KeyedSemaphore.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
/**
* Run an operation with a limit on number of ongoing asynchronous jobs for a specific key.
*
* All operations must have the same input type (Tin) and output type (Tout), and be processed by the same function;
* All operations must have the same input type (Tin) and output type (Tout), and be processed by the same function.
*
* `Tin` may be a callable invoked by the `$operation` for maximum flexibility,
* however this pattern is best avoided in favor of creating semaphores with a more narrow process.
*
Expand Down Expand Up @@ -47,15 +48,15 @@ final class KeyedSemaphore
* @param (Closure(Tk, Tin): Tout) $operation
*/
public function __construct(
private int $concurrencyLimit,
private Closure $operation,
private readonly int $concurrencyLimit,
private readonly Closure $operation,
) {
}

/**
* Run the operation using the given `$input`.
*
* If the concurrency limit has been reached, this method will wait until one of the ingoing operations has completed.
* If the concurrency limit has been reached for the given `$key`, this method will wait until one of the ingoing operations has completed.
*
* @param Tk $key
* @param Tin $input
Expand Down
2 changes: 1 addition & 1 deletion src/Psl/Async/KeyedSequence.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ final class KeyedSequence
* @param (Closure(Tk, Tin): Tout) $operation
*/
public function __construct(
private Closure $operation,
private readonly Closure $operation,
) {
}

Expand Down
Loading