Skip to content

Commit

Permalink
Fix BC in WorkerFactory constructor (#541)
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk authored Dec 24, 2024
1 parent fb4d5ec commit b9346fa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
5 changes: 4 additions & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1443,6 +1443,9 @@
<DeprecatedClass>
<code><![CDATA[new AnnotationReader()]]></code>
</DeprecatedClass>
<ImpureMethodCall>
<code><![CDATA[create]]></code>
</ImpureMethodCall>
<InternalClass>
<code><![CDATA[new Client($this->responses)]]></code>
</InternalClass>
Expand Down Expand Up @@ -1477,7 +1480,7 @@
<code><![CDATA[new static(
$converter ?? DataConverter::createDefault(),
$rpc ?? Goridge::create(),
$credentials ?? ServiceCredentials::create(),
$credentials,
)]]></code>
</UnsafeInstantiation>
</file>
Expand Down
6 changes: 3 additions & 3 deletions src/WorkerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ class WorkerFactory implements WorkerFactoryInterface, LoopInterface
public function __construct(
DataConverterInterface $dataConverter,
protected RPCConnectionInterface $rpc,
ServiceCredentials $credentials,
?ServiceCredentials $credentials = null,
) {
$this->converter = $dataConverter;
$this->boot($credentials);
$this->boot($credentials ?? ServiceCredentials::create());
}

public static function create(
Expand All @@ -119,7 +119,7 @@ public static function create(
return new static(
$converter ?? DataConverter::createDefault(),
$rpc ?? Goridge::create(),
$credentials ?? ServiceCredentials::create(),
$credentials,
);
}

Expand Down
6 changes: 3 additions & 3 deletions testing/src/WorkerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ public function __construct(
DataConverterInterface $dataConverter,
RPCConnectionInterface $rpc,
ActivityInvocationCacheInterface $activityCache,
ServiceCredentials $credentials,
?ServiceCredentials $credentials = null,
) {
$this->activityCache = $activityCache;

parent::__construct($dataConverter, $rpc, $credentials);
parent::__construct($dataConverter, $rpc, $credentials ?? ServiceCredentials::create());
}

public static function create(
Expand All @@ -45,7 +45,7 @@ public static function create(
$converter ?? DataConverter::createDefault(),
$rpc ?? Goridge::create(),
$activityCache ?? RoadRunnerActivityInvocationCache::create($converter),
$credentials ?? ServiceCredentials::create(),
$credentials,
);
}

Expand Down

0 comments on commit b9346fa

Please sign in to comment.