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

Implement template default types #1835

Draft
wants to merge 2 commits into
base: 1.9.x
Choose a base branch
from

Conversation

rvanvelzen
Copy link
Contributor

@ondrejmirtes
Copy link
Member

Feel free to rebase your PR without any Composer changes, I updated the parser on 1.9.x :)


/**
* @template T1 = true
* @template T2 = true
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder what syntax is for bound templates? Something like @template T of bool = true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

@ruudk
Copy link
Contributor

ruudk commented Mar 7, 2023

@rvanvelzen Are you still interested in solving this? Having default values would be extremely handy!

@rvanvelzen
Copy link
Contributor Author

@ruudk I won't have time to work on this in the foreseeable future, but I do intend to solve this.

That being said, anyone should feel free to take this over :)

@ondrejmirtes
Copy link
Member

@rvanvelzen I need to tell you that I really miss your contributions :) Not just this specific one, but in general - a PR from you was always something to look forward to :)

use function PHPStan\Testing\assertType;

/**
* @template T
Copy link
Contributor

@mvorisek mvorisek Dec 3, 2023

Choose a reason for hiding this comment

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

@template T of Xxx test should be added like in phpstan/phpstan#4801 (comment).

When of Xxx is specified, it should be used as implicit default type.

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.

Add support for template default types
5 participants