Skip to content

Commit d491b02

Browse files
committed
Bit of cleanup
1 parent 062fadc commit d491b02

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

src/Worker/DefaultWorkerFactory.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ final class DefaultWorkerFactory implements WorkerFactory
1414
{
1515
public const SCRIPT_PATH = __DIR__ . "/Internal/task-runner.php";
1616

17-
private ?ContextFactory $contextFactory;
18-
1917
/**
2018
* @param string $cacheClass Name of class implementing {@see Cache} to instantiate in each worker. Defaults
2119
* to {@see LocalCache}.
@@ -24,7 +22,7 @@ final class DefaultWorkerFactory implements WorkerFactory
2422
*/
2523
public function __construct(
2624
private ?string $bootstrapPath = null,
27-
?ContextFactory $contextFactory = null,
25+
private ?ContextFactory $contextFactory = null,
2826
private string $cacheClass = LocalCache::class,
2927
) {
3028
$this->contextFactory = $contextFactory;

src/Worker/DefaultWorkerPool.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ final class DefaultWorkerPool implements WorkerPool
2121
/** @var bool Indicates if the pool is currently running. */
2222
private bool $running = true;
2323

24-
/** @var int The maximum number of workers the pool should spawn. */
25-
private int $limit;
26-
27-
/** @var WorkerFactory A worker factory to be used to create new workers. */
28-
private ?WorkerFactory $factory;
29-
3024
/** @var \SplObjectStorage A collection of all workers in the pool. */
3125
private \SplObjectStorage $workers;
3226

@@ -50,17 +44,14 @@ final class DefaultWorkerPool implements WorkerPool
5044
*
5145
* @throws \Error
5246
*/
53-
public function __construct(int $limit = self::DEFAULT_WORKER_LIMIT, ?WorkerFactory $factory = null)
54-
{
47+
public function __construct(
48+
private int $limit = self::DEFAULT_WORKER_LIMIT,
49+
private ?WorkerFactory $factory = null,
50+
) {
5551
if ($limit < 0) {
5652
throw new \Error("Maximum size must be a non-negative integer");
5753
}
5854

59-
$this->limit = $limit;
60-
61-
// Use the global factory if none is given.
62-
$this->factory = $factory;
63-
6455
$this->workers = new \SplObjectStorage;
6556
$this->idleWorkers = new \SplQueue;
6657

0 commit comments

Comments
 (0)