Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable27] Fix/text processing types covariant stable27 #41997

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/public/TextProcessing/IProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/**
* This is the interface that is implemented by apps that
* implement a text processing provider
* @template T of ITaskType
* @psalm-template-covariant T of ITaskType
* @since 27.1.0
*/
interface IProvider {
Expand Down
14 changes: 6 additions & 8 deletions lib/public/TextProcessing/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
/**
* This is a text processing task
* @since 27.1.0
* @psalm-template T of ITaskType
* @psalm-template S as class-string<T>
* @psalm-template P as IProvider<T>
* @psalm-template-covariant T of ITaskType
*/
final class Task implements \JsonSerializable {
protected ?int $id = null;
Expand Down Expand Up @@ -73,7 +71,7 @@ final class Task implements \JsonSerializable {
protected int $status = self::STATUS_UNKNOWN;

/**
* @psalm-param S $type
* @psalm-param class-string<T> $type
* @param string $type
* @param string $input
* @param string $appId
Expand All @@ -91,7 +89,7 @@ final public function __construct(
}

/**
* @psalm-param P $provider
* @psalm-param IProvider<T> $provider
* @param IProvider $provider
* @return string
* @since 27.1.0
Expand All @@ -105,7 +103,7 @@ public function visitProvider(IProvider $provider): string {
}

/**
* @psalm-param P $provider
* @psalm-param IProvider<T> $provider
* @param IProvider $provider
* @return bool
* @since 27.1.0
Expand All @@ -115,7 +113,7 @@ public function canUseProvider(IProvider $provider): bool {
}

/**
* @psalm-return S
* @psalm-return class-string<T>
* @since 27.1.0
*/
final public function getType(): string {
Expand Down Expand Up @@ -203,7 +201,7 @@ final public function getUserId(): ?string {
}

/**
* @psalm-return array{id: ?int, type: S, status: 0|1|2|3|4, userId: ?string, appId: string, input: string, output: ?string, identifier: string}
* @psalm-return array{id: ?int, type: class-string<T>, status: 0|1|2|3|4, userId: ?string, appId: string, input: string, output: ?string, identifier: string}
* @since 27.1.0
*/
public function jsonSerialize(): array {
Expand Down
Loading