Skip to content

Failing test case for covariant templates#193

Open
gsteel wants to merge 1 commit intopatchlevel:1.24.xfrom
gsteel:template-types
Open

Failing test case for covariant templates#193
gsteel wants to merge 1 commit intopatchlevel:1.24.xfrom
gsteel:template-types

Conversation

@gsteel
Copy link
Copy Markdown
Contributor

@gsteel gsteel commented May 5, 2026

It is currently not possible to serialize types that are documented with @template-covariant

@gsteel
Copy link
Copy Markdown
Contributor Author

gsteel commented May 5, 2026

FYI: symfony/symfony#64130 but contributing to Symfony looks like hard work

@DavidBadura
Copy link
Copy Markdown
Member

Hey, thanks a lot for pushing this forward in Symfony as well! :)

@gsteel
Copy link
Copy Markdown
Contributor Author

gsteel commented May 6, 2026

It's worth mentioning that you can still annotate your stuff with

/**
 * @template-covariant T of MyType
 */
class Some {
    /**
     * @param MyType $things
     * @psalm-param T $things
     */
    public function __construct(public $things) {}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants