Skip to content

generics: fix position variance of readonly-by-phpdoc properties#2337

Merged
ondrejmirtes merged 1 commit intophpstan:1.10.xfrom
jiripudil:property-variance-for-readonly-by-phpdoc
Apr 11, 2023
Merged

generics: fix position variance of readonly-by-phpdoc properties#2337
ondrejmirtes merged 1 commit intophpstan:1.10.xfrom
jiripudil:property-variance-for-readonly-by-phpdoc

Conversation

@jiripudil
Copy link
Copy Markdown
Contributor

/**
* @template-covariant Value of string|list<string>
*
* @immutable
Copy link
Copy Markdown
Contributor

@staabm staabm Apr 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs another test-case with a @readonly-phpdoc property on a non-immutable class

seems this is working as expected already: https://phpstan.org/r/c1a29fdf-09c7-4500-a7c8-87a64de4ef9f

@ondrejmirtes ondrejmirtes merged commit 71b1ddc into phpstan:1.10.x Apr 11, 2023
@ondrejmirtes
Copy link
Copy Markdown
Member

Thank you!

@staabm
Copy link
Copy Markdown
Contributor

staabm commented Apr 11, 2023

thank you @jiripudil

@jiripudil jiripudil deleted the property-variance-for-readonly-by-phpdoc branch April 11, 2023 09:26
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.

Template type Value is declared as covariant, but occurs in invariant position in property

3 participants