Skip to content

Commit

Permalink
Revert "minor - fix allergy for type casting"
Browse files Browse the repository at this point in the history
This reverts commit cd2adad.
  • Loading branch information
Wirone committed May 7, 2024
1 parent 0220bf7 commit 3503ef7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Runner/Parallel/ParallelisationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class ParallelisationException extends \RuntimeException
{
public static function forUnknownIdentifier(ProcessIdentifier $identifier): self
{
return new self(sprintf('Unknown process identifier: %s.', $identifier->__toString()));
return new self('Unknown process identifier: '.(string) $identifier);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Runner/Parallel/ProcessFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function getCommandArgs(int $serverPort, ProcessIdentifier $identifier, R
'--port',
(string) $serverPort,
'--identifier',
escapeshellarg($identifier->__toString()),
escapeshellarg((string) $identifier),
];

if ($runnerConfig->isDryRun()) {
Expand Down
10 changes: 5 additions & 5 deletions src/Runner/Parallel/ProcessPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ public function __construct(ServerInterface $server, ?callable $onServerClose =

public function getProcess(ProcessIdentifier $identifier): Process
{
if (!isset($this->processes[$identifier->__toString()])) {
if (!isset($this->processes[(string) $identifier])) {
throw ParallelisationException::forUnknownIdentifier($identifier);
}

return $this->processes[$identifier->__toString()];
return $this->processes[(string) $identifier];
}

public function addProcess(ProcessIdentifier $identifier, Process $process): void
{
$this->processes[$identifier->__toString()] = $process;
$this->processes[(string) $identifier] = $process;
}

public function endProcessIfKnown(ProcessIdentifier $identifier): void
{
if (!isset($this->processes[$identifier->__toString()])) {
if (!isset($this->processes[(string) $identifier])) {
return;
}

Expand All @@ -77,7 +77,7 @@ private function endProcess(ProcessIdentifier $identifier): void
{
$this->getProcess($identifier)->quit();

unset($this->processes[$identifier->__toString()]);
unset($this->processes[(string) $identifier]);

if (0 === \count($this->processes)) {
$this->server->close();
Expand Down

0 comments on commit 3503ef7

Please sign in to comment.