Skip to content

Add @template-covariant support - #34

Merged
ondrejmirtes merged 1 commit into
phpstan:masterfrom
arnaud-lb:template-covariant
Nov 7, 2019
Merged

Add @template-covariant support#34
ondrejmirtes merged 1 commit into
phpstan:masterfrom
arnaud-lb:template-covariant

Conversation

@arnaud-lb

Copy link
Copy Markdown
Contributor

No description provided.

@JanTvrdik

Copy link
Copy Markdown
Collaborator

That seems way too long. Why not extend the existing @template annotation to support in/out keywords (Kotlin) or +/- signs (Scala)?

/**
 * @template in T
 */

@ondrejmirtes

Copy link
Copy Markdown
Member

We need to support what's already in the wild. But we also plan to support @phpstan-generic<K, V> syntax and prefer it in the docs etc. See the discussion there (and feel free to contribute to it!): phpstan/phpstan#2527

@muglug

muglug commented Nov 6, 2019

Copy link
Copy Markdown

That seems way too long. Why not extend the existing @template annotation to support in/out keywords (Kotlin) or +/- signs (Scala)?

The reason I went with -covariant is that it seemed to me, as a newcomer to the idea, something that should be annotated fairly explicitly.

Also I felt out was confusing given by-ref parameters: vimeo/psalm#1603 (comment)

@ondrejmirtes
ondrejmirtes merged commit 3edb515 into phpstan:master Nov 7, 2019
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.

4 participants