Skip to content

Commit 118beeb

Browse files
committed
refactor: update WorkerDeploymentOptions to use WorkerDeploymentVersion instead of string
1 parent 9e0ec36 commit 118beeb

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/Worker/Versioning/WorkerDeploymentOptions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class WorkerDeploymentOptions
2525
private readonly bool $useVersioning;
2626

2727
#[Marshal(name: 'Version', nullable: true)]
28-
private readonly ?string $version;
28+
private readonly ?WorkerDeploymentVersion $version;
2929

3030
#[Marshal(name: 'DefaultVersioningBehavior', type: EnumValueType::class)]
3131
private readonly VersioningBehavior $defaultVersioningBehavior;
@@ -62,7 +62,7 @@ public function withUseVersioning(bool $value): self
6262
public function withVersion(string|WorkerDeploymentVersion $version): self
6363
{
6464
/** @see self::$version */
65-
return $this->with('version', (string) $version);
65+
return $this->with('version', \is_string($version) ? WorkerDeploymentVersion::fromString($version) : $version);
6666
}
6767

6868
/**

src/Worker/Versioning/WorkerDeploymentVersion.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Temporal\Worker\Versioning;
66

77
use Temporal\Exception\InvalidArgumentException;
8+
use Temporal\Internal\Marshaller\Meta\Marshal;
89
use Temporal\Internal\Traits\CloneWith;
910

1011
/**
@@ -23,11 +24,13 @@ private function __construct(
2324
* The combination of {@see $deployment_name} and {@see $buildId} uniquely identifies this
2425
* Version within the namespace, because Deployment names are unique within a namespace.
2526
*/
27+
#[Marshal('DeploymentName')]
2628
public readonly string $deploymentName,
2729

2830
/**
2931
* Identifies the Worker Deployment this Version is part of.
3032
*/
33+
#[Marshal('BuildId')]
3134
public readonly string $buildId,
3235
) {}
3336

0 commit comments

Comments
 (0)