Skip to content

Commit

Permalink
Allow passing fiber factory to tracing fiber factory
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed May 1, 2024
1 parent 7cc40ca commit f897d2f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/EventLoop/TracingFiberFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ final class TracingFiberFactory implements FiberFactory, Countable, IteratorAggr
/**
* @var \WeakMap<\Fiber, null>
*/
private \WeakMap $map;
private readonly \WeakMap $map;

public function __construct()
{
public function __construct(
private readonly FiberFactory $fiberFactory = new DefaultFiberFactory()
) {
/** @var \WeakMap<\Fiber, null> */
$this->map = new \WeakMap();
}
Expand All @@ -35,7 +36,7 @@ public function __construct()
*/
public function create(callable $callback): \Fiber
{
$f = new \Fiber($callback);
$f = $this->fiberFactory->create($callback);
$this->map[$f] = null;

Check failure on line 40 in src/EventLoop/TracingFiberFactory.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

InaccessibleProperty

src/EventLoop/TracingFiberFactory.php:40:9: InaccessibleProperty: Revolt\EventLoop\TracingFiberFactory::$map is marked readonly (see https://psalm.dev/054)
return $f;
}
Expand Down

0 comments on commit f897d2f

Please sign in to comment.