Skip to content

Commit

Permalink
Update code style; 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 942885c commit ca79d75
Show file tree
Hide file tree
Showing 240 changed files with 234 additions and 2,822 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"jetbrains/phpstorm-attributes": "dev-master@dev",
"laminas/laminas-code": "^4.0",
"phpunit/phpunit": "^10.5",
"spiral/code-style": "~2.1.2",
"spiral/code-style": "~2.2.1",
"spiral/core": "^3.13",
"symfony/var-dumper": "^6.0 || ^7.0",
"vimeo/psalm": "^4.30 || ^5.4"
Expand Down Expand Up @@ -91,7 +91,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.11.x-dev"
"dev-master": "2.12.x-dev"
}
},
"config": {
Expand Down
3 changes: 0 additions & 3 deletions src/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ final class Activity extends Facade
/**
* Returns information about current activity execution.
*
* @return ActivityInfo
* @throws OutOfContextException in the absence of the activity execution context.
*/
public static function getInfo(): ActivityInfo
Expand All @@ -53,7 +52,6 @@ public static function getInfo(): ActivityInfo
* }
* ```
*
* @return ValuesInterface
* @throws OutOfContextException in the absence of the activity execution context.
*/
public static function getInput(): ValuesInterface
Expand All @@ -69,7 +67,6 @@ public static function getInput(): ValuesInterface
*
* This method returns **true** if the first argument has been passed to the {@see Activity::heartbeat()} method.
*
* @return bool
* @throws OutOfContextException in the absence of the activity execution context.
*/
public static function hasHeartbeatDetails(): bool
Expand Down
4 changes: 0 additions & 4 deletions src/Activity/ActivityContextInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ interface ActivityContextInterface
*
* @see Activity::getInfo()
*
* @return ActivityInfo
*/
public function getInfo(): ActivityInfo;

Expand All @@ -31,7 +30,6 @@ public function getInfo(): ActivityInfo;
*
* @see Activity::getInput()
*
* @return ValuesInterface
*/
public function getInput(): ValuesInterface;

Expand All @@ -40,7 +38,6 @@ public function getInput(): ValuesInterface;
*
* @see Activity::hasHeartbeatDetails()
*
* @return bool
*/
public function hasHeartbeatDetails(): bool;

Expand All @@ -59,7 +56,6 @@ public function getHeartbeatDetails($type = null);
*
* @see Activity::doNotCompleteOnReturn()
*
* @return void
*/
public function doNotCompleteOnReturn(): void;

Expand Down
20 changes: 0 additions & 20 deletions src/Activity/ActivityInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,16 @@ final class ActivityInfo
*
* @see ActivityCompletionClientInterface::complete()
*
* @var string
*/
#[Marshal(name: 'TaskToken')]
public string $taskToken;

/**
* @var WorkflowType|null
*/
#[Marshal(name: 'WorkflowType', type: NullableType::class, of: WorkflowType::class)]
public ?WorkflowType $workflowType = null;

/**
* @var string
*/
#[Marshal(name: 'WorkflowNamespace')]
public string $workflowNamespace = 'default';

/**
* @var WorkflowExecution|null
*/
#[Marshal(name: 'WorkflowExecution', type: NullableType::class, of: WorkflowExecution::class)]
public ?WorkflowExecution $workflowExecution = null;

Expand All @@ -67,53 +57,44 @@ final class ActivityInfo
*
* @see ActivityCompletionClientInterface::complete()
*
* @var string
*/
#[Marshal(name: 'ActivityID')]
public string $id;

/**
* Type (name) of the activity.
*
* @var ActivityType
*/
#[Marshal(name: 'ActivityType', type: ObjectType::class, of: ActivityType::class)]
public ActivityType $type;

/**
* @var string
*/
#[Marshal(name: 'TaskQueue')]
public string $taskQueue = WorkerFactoryInterface::DEFAULT_TASK_QUEUE;

/**
* Maximum time between heartbeats. 0 means no heartbeat needed.
*
* @var \DateInterval
*/
#[Marshal(name: 'HeartbeatTimeout', type: DateIntervalType::class)]
public \DateInterval $heartbeatTimeout;

/**
* Time of activity scheduled by a workflow
*
* @var \DateTimeInterface
*/
#[Marshal(name: 'ScheduledTime', type: DateTimeType::class)]
public \DateTimeInterface $scheduledTime;

/**
* Time of activity start
*
* @var \DateTimeInterface
*/
#[Marshal(name: 'StartedTime', type: DateTimeType::class)]
public \DateTimeInterface $startedTime;

/**
* Time of activity timeout
*
* @var \DateTimeInterface
*/
#[Marshal(name: 'Deadline', type: DateTimeType::class)]
public \DateTimeInterface $deadline;
Expand All @@ -122,7 +103,6 @@ final class ActivityInfo
* Attempt starts from 1, and increased by 1 for every retry if
* retry policy is specified.
*
* @var int
*/
#[Marshal(name: 'Attempt')]
public int $attempt = 1;
Expand Down
3 changes: 0 additions & 3 deletions src/Activity/ActivityInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ class ActivityInterface
#[Immutable]
public string $prefix = '';

/**
* @param string $prefix
*/
public function __construct(string $prefix = '')
{
$this->prefix = $prefix;
Expand Down
5 changes: 1 addition & 4 deletions src/Activity/ActivityMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ final class ActivityMethod
#[Immutable]
public ?string $name = null;

/**
* @param string|null $name
*/
public function __construct(string $name = null)
public function __construct(?string $name = null)
{
$this->name = $name;
}
Expand Down
6 changes: 1 addition & 5 deletions src/Activity/ActivityOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,9 @@ public function __construct()
}

/**
* @param MethodRetry|null $retry
* @return $this
*/
public function mergeWith(MethodRetry $retry = null): self
public function mergeWith(?MethodRetry $retry = null): self
{
$self = clone $this;

Expand All @@ -142,7 +141,6 @@ public function mergeWith(MethodRetry $retry = null): self
*
* By default, it is the same task list name the workflow was started with.
*
* @param string|null $taskQueue
* @return $this
*/
#[Pure]
Expand Down Expand Up @@ -269,7 +267,6 @@ public function withCancellationType(ActivityCancellationType|int $type): self
}

/**
* @param string $activityId
* @return $this
*/
#[Pure]
Expand All @@ -283,7 +280,6 @@ public function withActivityId(string $activityId): self
}

/**
* @param RetryOptions|null $options
* @return $this
*/
#[Pure]
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;
}
1 change: 0 additions & 1 deletion src/Activity/ActivityType.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class ActivityType
/**
* @psalm-readonly
* @psalm-allow-private-mutation
* @var string
*/
#[Marshal(name: 'Name')]
public string $name = '';
Expand Down
3 changes: 0 additions & 3 deletions src/Activity/LocalActivityInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ final class LocalActivityInterface extends ActivityInterface
#[Immutable]
public string $prefix = '';

/**
* @param string $prefix
*/
public function __construct(string $prefix = '')
{
$this->prefix = $prefix;
Expand Down
4 changes: 1 addition & 3 deletions src/Activity/LocalActivityOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ public function __construct()
}

/**
* @param MethodRetry|null $retry
* @return $this
*/
public function mergeWith(MethodRetry $retry = null): self
public function mergeWith(?MethodRetry $retry = null): self
{
$self = clone $this;

Expand Down Expand Up @@ -142,7 +141,6 @@ public function withStartToCloseTimeout($timeout): self
}

/**
* @param RetryOptions|null $options
* @return $this
*/
#[Pure]
Expand Down
28 changes: 0 additions & 28 deletions src/Client/ActivityCompletionClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,61 +20,34 @@
interface ActivityCompletionClientInterface
{
/**
* @param string $workflowId
* @param string|null $runId
* @param string $activityId
* @param mixed $result
*/
public function complete(string $workflowId, ?string $runId, string $activityId, $result = null): void;

/**
* @param string $taskToken
* @param mixed $result
*/
public function completeByToken(string $taskToken, $result = null): void;

/**
* @param string $workflowId
* @param string|null $runId
* @param string $activityId
* @param \Throwable $error
*/
public function completeExceptionally(
string $workflowId,
?string $runId,
string $activityId,
\Throwable $error,
): void;

/**
* @param string $taskToken
* @param \Throwable $error
*/
public function completeExceptionallyByToken(string $taskToken, \Throwable $error): void;

/**
* @param string $workflowId
* @param string|null $runId
* @param string $activityId
* @param $details
*/
public function reportCancellation(
string $workflowId,
?string $runId,
string $activityId,
$details = null,
): void;

/**
* @param string $taskToken
* @param $details
*/
public function reportCancellationByToken(string $taskToken, $details = null): void;

/**
* @param string $workflowId
* @param string|null $runId
* @param string $activityId
* @param mixed $details
*
* @throw ActivityCanceledException
Expand All @@ -87,7 +60,6 @@ public function recordHeartbeat(
);

/**
* @param string $taskToken
* @param mixed $details
*
* @throw ActivityCanceledException
Expand Down
7 changes: 0 additions & 7 deletions src/Client/ClientOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,8 @@ class ClientOptions
*/
public string $namespace = self::DEFAULT_NAMESPACE;

/**
* @var string
*/
public string $identity;

/**
* @var int
*/
#[ExpectedValues(valuesFromClass: QueryRejectCondition::class)]
public int $queryRejectionCondition = QueryRejectCondition::QUERY_REJECT_CONDITION_NONE;

Expand All @@ -65,7 +59,6 @@ public function withNamespace(string $namespace): self
}

/**
* @param string $identity
* @return $this
*/
#[Pure]
Expand Down
1 change: 0 additions & 1 deletion src/Client/Common/Paginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ public function getPageNumber(): int
* Note: the method may call yet another RPC to get total number of items.
* It means that the result may be different from the number of items at the moment of the pagination start.
*
* @return int
* @throws \LogicException If counter is not set.
*/
public function count(): int
Expand Down
3 changes: 0 additions & 3 deletions src/Client/Common/RpcRetryOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ public static function fromRetryOptions(RetryOptions $options): self
* @param DateIntervalValue|null $interval Interval to wait on first retry, on congestion failures.
* Defaults to 1000ms, which is used if set to {@see null}.
*
* @return self
*
* @psalm-suppress ImpureMethodCall
*/
#[Pure]
Expand All @@ -76,7 +74,6 @@ public function withCongestionInitialInterval($interval): self
* @param null|float $coefficient Maximum amount of jitter.
* Default will be used if set to {@see null}.
*
* @return self
*/
#[Pure]
public function withMaximumJitterCoefficient(?float $coefficient): self
Expand Down
Loading

0 comments on commit ca79d75

Please sign in to comment.