Skip to content
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,9 @@ time differences independent of wall-time.

```php
/**
* @template TReturn
* @param Closure(...):TReturn $closure
* @return Closure(...):TReturn
* @template TClosure of \Closure
* @param TClosure $closure
* @return TClosure
*/
function weakClosure(Closure $closure): Closure
```
Expand Down
8 changes: 4 additions & 4 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ function trapSignal(int|array $signals, bool $reference = true, ?Cancellation $c
* prevent or delay automatic garbage collection.
* Invoking the returned Closure after the object is destroyed will throw an instance of Error.
*
* @template TReturn
* @template TClosure of \Closure
*
* @param \Closure(...):TReturn $closure
* @param TClosure $closure
*
* @return \Closure(...):TReturn
* @return TClosure
*/
function weakClosure(\Closure $closure): \Closure
{
Expand Down Expand Up @@ -167,7 +167,7 @@ function weakClosure(\Closure $closure): \Closure
throw new \RuntimeException('Unable to rebind closure scoped to ' . ($scope?->name ?? $that::class));
}

/** @var \Closure(...):TReturn */
/** @var TClosure */
return static function (mixed ...$args) use ($reference, $closure, $useBindTo): mixed {
$that = $reference->get();
if (!$that) {
Expand Down
Loading