Skip to content

Commit

Permalink
Fix PHP8.4 nullable types deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Dec 9, 2024
1 parent a271938 commit 0dba125
Show file tree
Hide file tree
Showing 83 changed files with 230 additions and 230 deletions.
2 changes: 1 addition & 1 deletion src/Activity/ActivityMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class ActivityMethod
#[Immutable]
public ?string $name = null;

public function __construct(string $name = null)
public function __construct(?string $name = null)
{
$this->name = $name;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Activity/ActivityOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function __construct()
/**
* @return $this
*/
public function mergeWith(MethodRetry $retry = null): self
public function mergeWith(?MethodRetry $retry = null): self
{
$self = clone $this;

Expand Down
2 changes: 1 addition & 1 deletion src/Activity/ActivityOptionsInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
*/
interface ActivityOptionsInterface
{
public function mergeWith(MethodRetry $retry = null): self;
public function mergeWith(?MethodRetry $retry = null): self;
}
2 changes: 1 addition & 1 deletion src/Activity/LocalActivityOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function __construct()
/**
* @return $this
*/
public function mergeWith(MethodRetry $retry = null): self
public function mergeWith(?MethodRetry $retry = null): self
{
$self = clone $this;

Expand Down
8 changes: 4 additions & 4 deletions src/Client/GRPC/BaseClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ public static function create(string $address): static
*/
public static function createSSL(
string $address,
string $crt = null,
string $clientKey = null,
string $clientPem = null,
string $overrideServerName = null,
?string $crt = null,
?string $clientKey = null,
?string $clientPem = null,
?string $overrideServerName = null,
): static {
if (!\extension_loaded('grpc')) {
throw new \RuntimeException('The gRPC extension is required to use Temporal Client.');
Expand Down
124 changes: 62 additions & 62 deletions src/Client/GRPC/ServiceClient.php

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/Client/ScheduleClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ final class ScheduleClient implements ScheduleClientInterface

public function __construct(
ServiceClientInterface $serviceClient,
ClientOptions $options = null,
DataConverterInterface $converter = null,
?ClientOptions $options = null,
?DataConverterInterface $converter = null,
) {
$this->client = $serviceClient;
$this->clientOptions = $options ?? new ClientOptions();
Expand All @@ -62,8 +62,8 @@ public function __construct(

public static function create(
ServiceClientInterface $serviceClient,
ClientOptions $options = null,
DataConverterInterface $converter = null,
?ClientOptions $options = null,
?DataConverterInterface $converter = null,
): ScheduleClientInterface {
return new self($serviceClient, $options, $converter);
}
Expand Down
16 changes: 8 additions & 8 deletions src/Client/WorkflowClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ class WorkflowClient implements WorkflowClientInterface

public function __construct(
ServiceClientInterface $serviceClient,
ClientOptions $options = null,
DataConverterInterface $converter = null,
PipelineProvider $interceptorProvider = null,
?ClientOptions $options = null,
?DataConverterInterface $converter = null,
?PipelineProvider $interceptorProvider = null,
) {
$this->client = $serviceClient;
$this->interceptorPipeline = ($interceptorProvider ?? new SimplePipelineProvider())
Expand All @@ -83,9 +83,9 @@ public function __construct(
*/
public static function create(
ServiceClientInterface $serviceClient,
ClientOptions $options = null,
DataConverterInterface $converter = null,
PipelineProvider $interceptorProvider = null,
?ClientOptions $options = null,
?DataConverterInterface $converter = null,
?PipelineProvider $interceptorProvider = null,
): self {
return new self($serviceClient, $options, $converter, $interceptorProvider);
}
Expand Down Expand Up @@ -207,7 +207,7 @@ public function startWithSignal(

public function newWorkflowStub(
string $class,
WorkflowOptions $options = null,
?WorkflowOptions $options = null,
): object {
$workflow = $this->reader->fromClass($class);

Expand All @@ -220,7 +220,7 @@ public function newWorkflowStub(

public function newUntypedWorkflowStub(
string $workflowType,
WorkflowOptions $options = null,
?WorkflowOptions $options = null,
): WorkflowStubInterface {
$options ??= new WorkflowOptions();

Expand Down
4 changes: 2 additions & 2 deletions src/Client/WorkflowClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function startWithSignal(
*/
public function newWorkflowStub(
string $class,
WorkflowOptions $options = null,
?WorkflowOptions $options = null,
): object;

/**
Expand All @@ -78,7 +78,7 @@ public function newWorkflowStub(
*/
public function newUntypedWorkflowStub(
string $workflowType,
WorkflowOptions $options = null,
?WorkflowOptions $options = null,
): WorkflowStubInterface;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Client/WorkflowOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function __construct()
*
* @return self return a new {@see self} instance with merged options
*/
public function mergeWith(MethodRetry $retry = null, CronSchedule $cron = null): self
public function mergeWith(?MethodRetry $retry = null, ?CronSchedule $cron = null): self
{
$self = clone $this;

Expand Down
2 changes: 1 addition & 1 deletion src/Common/RetryOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class RetryOptions extends Options
#[Marshal(name: 'non_retryable_error_types')]
public array $nonRetryableExceptions = self::DEFAULT_NON_RETRYABLE_EXCEPTIONS;

public function mergeWith(MethodRetry $retry = null): self
public function mergeWith(?MethodRetry $retry = null): self
{
$self = clone $this;

Expand Down
4 changes: 2 additions & 2 deletions src/DataConverter/EncodedValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static function sliceValues(
DataConverterInterface $converter,
ValuesInterface $values,
int $offset,
int $length = null,
?int $length = null,
): ValuesInterface {
$payloads = $values->toPayloads();
$newPayloads = new Payloads();
Expand Down Expand Up @@ -90,7 +90,7 @@ static function (mixed $value) use ($type) {
);
}

public static function fromValues(array $values, DataConverterInterface $dataConverter = null): static
public static function fromValues(array $values, ?DataConverterInterface $dataConverter = null): static
{
$ev = new static();
$ev->values = \array_values($values);
Expand Down
2 changes: 1 addition & 1 deletion src/DataConverter/JsonConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class JsonConverter extends Converter

private MarshallerInterface $marshaller;

public function __construct(MarshallerInterface $marshaller = null)
public function __construct(?MarshallerInterface $marshaller = null)
{
$this->marshaller = $marshaller ?? self::createDefaultMarshaller();
}
Expand Down
2 changes: 1 addition & 1 deletion src/DataConverter/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final class Type
*/
public function __construct(
private readonly string $name = Type::TYPE_ANY,
bool $allowsNull = null,
?bool $allowsNull = null,
private readonly bool $isArrayOf = false,
) {
$this->allowsNull = $allowsNull ?? (
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/Client/ActivityCompletionException.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static function fromPreviousWithActivityId(string $activityId, \Throwable
/**
* @return static
*/
public static function fromActivityInfo(ActivityInfo $info, \Throwable $e = null): self
public static function fromActivityInfo(ActivityInfo $info, ?\Throwable $e = null): self
{
$e = new static(
self::buildMessage(
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/Client/ServiceClientException.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ServiceClientException extends \RuntimeException
/**
* @throws \Exception
*/
public function __construct(\stdClass $status, \Throwable $previous = null)
public function __construct(\stdClass $status, ?\Throwable $previous = null)
{
$this->status = new Status();

Expand Down
8 changes: 4 additions & 4 deletions src/Exception/Client/WorkflowException.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class WorkflowException extends TemporalException
public function __construct(
?string $message,
WorkflowExecution $execution,
string $workflowType = null,
\Throwable $previous = null,
?string $workflowType = null,
?\Throwable $previous = null,
) {
parent::__construct(
self::buildMessage(
Expand All @@ -42,8 +42,8 @@ public function __construct(

public static function withoutMessage(
WorkflowExecution $execution,
string $workflowType = null,
\Throwable $previous = null,
?string $workflowType = null,
?\Throwable $previous = null,
): WorkflowException {
return new static(null, $execution, $workflowType, $previous);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class WorkflowExecutionAlreadyStartedException extends WorkflowException
{
public function __construct(
WorkflowExecution $execution,
string $type = null,
\Throwable $previous = null,
?string $type = null,
?\Throwable $previous = null,
) {
parent::__construct(null, $execution, $type, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/Client/WorkflowFailedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct(
?string $type,
int $lastWorkflowTaskCompletedEventId,
int $retryState,
\Throwable $previous = null,
?\Throwable $previous = null,
) {
parent::__construct(null, $execution, $type, $previous);

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/Client/WorkflowQueryRejectedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct(
string $type,
int $queryRejectCondition,
int $workflowExecutionStatus,
\Throwable $previous = null,
?\Throwable $previous = null,
) {
parent::__construct(null, $execution, $type, $previous);
$this->queryRejectCondition = $queryRejectCondition;
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/Failure/ActivityFailure.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(
string $activityId,
int $retryState,
string $identity,
\Throwable $previous = null,
?\Throwable $previous = null,
) {
parent::__construct(
self::buildMessage(
Expand Down
4 changes: 2 additions & 2 deletions src/Exception/Failure/ApplicationFailure.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public function __construct(
string $message,
string $type,
bool $nonRetryable,
ValuesInterface $details = null,
\Throwable $previous = null,
?ValuesInterface $details = null,
?\Throwable $previous = null,
private ?\DateInterval $nextRetryDelay = null,
) {
parent::__construct(
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/Failure/CanceledFailure.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CanceledFailure extends TemporalFailure
{
private ValuesInterface $details;

public function __construct(string $message, ValuesInterface $details = null, \Throwable $previous = null)
public function __construct(string $message, ?ValuesInterface $details = null, ?\Throwable $previous = null)
{
parent::__construct($message, '', $previous);
$this->details = $details ?? EncodedValues::empty();
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/Failure/ChildWorkflowFailure.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct(
WorkflowExecution $execution,
string $namespace,
int $retryState,
\Throwable $previous = null,
?\Throwable $previous = null,
) {
parent::__construct(
self::buildMessage(
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/Failure/ServerFailure.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ServerFailure extends TemporalFailure
{
private bool $nonRetryable;

public function __construct(string $message, bool $nonRetryable, \Throwable $previous = null)
public function __construct(string $message, bool $nonRetryable, ?\Throwable $previous = null)
{
parent::__construct(
$message,
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/Failure/TemporalFailure.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class TemporalFailure extends TemporalException implements \Stringable
private string $originalMessage;
private ?string $originalStackTrace = null;

public function __construct(string $message, string $originalMessage = null, \Throwable $previous = null)
public function __construct(string $message, ?string $originalMessage = null, ?\Throwable $previous = null)
{
parent::__construct($message, 0, $previous);

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/Failure/TerminatedFailure.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class TerminatedFailure extends TemporalFailure
{
public function __construct(string $message, \Throwable $previous = null)
public function __construct(string $message, ?\Throwable $previous = null)
{
parent::__construct($message, $message, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/Failure/TimeoutFailure.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct(
string $message,
ValuesInterface $lastHeartbeatDetails,
int $timeoutWorkflowType,
\Throwable $previous = null,
?\Throwable $previous = null,
) {
parent::__construct(
self::buildMessage(\compact('message', 'timeoutWorkflowType') + ['type' => 'TimeoutFailure']),
Expand Down
4 changes: 2 additions & 2 deletions src/Interceptor/ActivityInbound/ActivityInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public function __construct(
) {}

public function with(
ValuesInterface $arguments = null,
HeaderInterface $header = null,
?ValuesInterface $arguments = null,
?HeaderInterface $header = null,
): self {
return new self(
$arguments ?? $this->arguments,
Expand Down
2 changes: 1 addition & 1 deletion src/Interceptor/WorkflowClient/CancelInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(
) {}

public function with(
WorkflowExecution $workflowExecution = null,
?WorkflowExecution $workflowExecution = null,
): self {
return new self(
$workflowExecution ?? $this->workflowExecution,
Expand Down
4 changes: 2 additions & 2 deletions src/Interceptor/WorkflowClient/DescribeInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public function __construct(
) {}

public function with(
WorkflowExecution $workflowExecution = null,
string $namespace = null,
?WorkflowExecution $workflowExecution = null,
?string $namespace = null,
): self {
return new self(
$workflowExecution ?? $this->workflowExecution,
Expand Down
6 changes: 3 additions & 3 deletions src/Interceptor/WorkflowClient/GetResultInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public function __construct(
) {}

public function with(
WorkflowExecution $workflowExecution = null,
string $workflowType = null,
int $timeout = null,
?WorkflowExecution $workflowExecution = null,
?string $workflowType = null,
?int $timeout = null,
): self {
return new self(
$workflowExecution ?? $this->workflowExecution,
Expand Down
6 changes: 3 additions & 3 deletions src/Interceptor/WorkflowClient/QueryInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public function __construct(
) {}

public function with(
WorkflowExecution $workflowExecution = null,
string $queryType = null,
ValuesInterface $arguments = null,
?WorkflowExecution $workflowExecution = null,
?string $queryType = null,
?ValuesInterface $arguments = null,
): self {
return new self(
$workflowExecution ?? $this->workflowExecution,
Expand Down
4 changes: 2 additions & 2 deletions src/Interceptor/WorkflowClient/SignalInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public function __construct(
) {}

public function with(
string $signalName = null,
ValuesInterface $arguments = null,
?string $signalName = null,
?ValuesInterface $arguments = null,
): self {
return new self(
$this->workflowExecution,
Expand Down
Loading

0 comments on commit 0dba125

Please sign in to comment.