Skip to content

Commit

Permalink
Fix psalm issues
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Apr 8, 2024
1 parent ea771c4 commit df2c0a0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 44 deletions.
4 changes: 2 additions & 2 deletions src/Client/ClientOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ClientOptions
public const DEFAULT_NAMESPACE = 'default';

/**
* @var string
* @var non-empty-string
*/
public string $namespace = self::DEFAULT_NAMESPACE;

Expand All @@ -51,7 +51,7 @@ public function __construct()
}

/**
* @param string $namespace
* @param non-empty-string $namespace
* @return $this
*/
#[Pure]
Expand Down
41 changes: 1 addition & 40 deletions src/Client/GRPC/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ final class Context implements ContextInterface
private array $metadata;
private RetryOptions $retryOptions;

/**
* Context constructor.
*/
private function __construct()
{
$this->retryOptions = RetryOptions::new()
Expand All @@ -38,11 +35,6 @@ private function __construct()
];
}

/**
* @param DateInterval|int $timeout
* @param string $format
* @return $this
*/
public function withTimeout($timeout, string $format = DateInterval::FORMAT_SECONDS): self
{
$internal = DateInterval::parse($timeout, $format);
Expand All @@ -53,10 +45,6 @@ public function withTimeout($timeout, string $format = DateInterval::FORMAT_SECO
return $ctx;
}

/**
* @param \DateTimeInterface $deadline
* @return $this
*/
public function withDeadline(\DateTimeInterface $deadline): self
{
$ctx = clone $this;
Expand All @@ -65,10 +53,6 @@ public function withDeadline(\DateTimeInterface $deadline): self
return $ctx;
}

/**
* @param array $options
* @return $this
*/
public function withOptions(array $options): self
{
$ctx = clone $this;
Expand All @@ -77,10 +61,6 @@ public function withOptions(array $options): self
return $ctx;
}

/**
* @param array $metadata
* @return $this
*/
public function withMetadata(array $metadata): self
{
$ctx = clone $this;
Expand All @@ -89,10 +69,6 @@ public function withMetadata(array $metadata): self
return $ctx;
}

/**
* @param RetryOptions $options
* @return ContextInterface
*/
public function withRetryOptions(RetryOptions $options): ContextInterface
{
$ctx = clone $this;
Expand All @@ -101,42 +77,27 @@ public function withRetryOptions(RetryOptions $options): ContextInterface
return $ctx;
}

/**
* @return array
*/
public function getOptions(): array
{
return $this->options;
}

/**
* @return array
*/
public function getMetadata(): array
{
return $this->metadata;
}

/**
* @return \DateTimeInterface|null
*/
public function getDeadline(): ?\DateTimeInterface
{
return $this->deadline;
}

/**
* @return RetryOptions
*/
public function getRetryOptions(): RetryOptions
{
return $this->retryOptions;
}

/**
* @return Context
*/
public static function default()
public static function default(): self
{
return new self();
}
Expand Down
5 changes: 4 additions & 1 deletion src/Client/GRPC/ContextInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
use Temporal\Common\RetryOptions;
use Temporal\Internal\Support\DateInterval;

/**
* @psalm-import-type DateIntervalValue from DateInterval
*/
interface ContextInterface
{
/**
* @param DateInterval|int $timeout
* @param DateIntervalValue $timeout
* @param string $format
* @return $this
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Client/WorkflowClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function __construct(
$this->reader = new WorkflowReader($this->createReader());
}

public function __clone(): void
public function __clone()
{
$this->starter = null;
}
Expand Down

0 comments on commit df2c0a0

Please sign in to comment.