Skip to content

Commit

Permalink
Optimize Thread\Pool::withArguments()
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Sep 30, 2024
1 parent 6f6113a commit f7c16a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/core/Thread/Pool.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(string $runnableClass, int $threadNum)
$this->threadNum = $threadNum;
}

public function withArguments(array $arguments): static
public function withArguments(...$arguments): static
{
$this->arguments = $arguments;
return $this;
Expand All @@ -66,7 +66,7 @@ public function withClassDefinitionFile(string $classDefinitionFile): static
/**
* @throws \ReflectionException
*/
public function start(array $arguments = []): void
public function start(): void
{
if (empty($this->classDefinitionFile) and class_exists($this->runnableClass, false)) {
$file = (new \ReflectionClass($this->runnableClass))->getFileName();
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Thread/PoolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function testPool(): void

(new Pool(TestThread::class, 4))
->withClassDefinitionFile(dirname(__DIR__, 2) . '/TestThread.php')
->withArguments([uniqid(), $map])
->withArguments(uniqid(), $map)
->start()
;

Expand Down

0 comments on commit f7c16a7

Please sign in to comment.