- Issue created by @dieterholvoet
- Open on Drupal.org →Environment: PHP 8.2 & MySQL 8last update
over 1 year ago Not currently mergeable. - @dieterholvoet opened merge request.
- Status changed to Needs review
over 1 year ago 12:03pm 14 August 2023 - last update
over 1 year ago 29,959 pass - Status changed to RTBC
over 1 year ago 6:31pm 15 August 2023 - 🇺🇸United States smustgrave
Seems to make sense but can't find any example in core where this has been used before so will see what the committers think.
- last update
about 1 year ago 29,961 pass - last update
about 1 year ago 30,047 pass - last update
about 1 year ago 30,051 pass - Status changed to Needs review
about 1 year ago 8:43am 21 August 2023 - Status changed to RTBC
about 1 year ago 6:41pm 21 August 2023 - 🇺🇸United States smustgrave
Would agree T is not clear at all without looking at this issue. But would also agree using "Template" I would assume there's a file for it. Of the two think T avoids the issue more.
- last update
about 1 year ago 30,056 pass - last update
about 1 year ago 30,058 pass - last update
about 1 year ago 30,060 pass - last update
about 1 year ago 30,060 pass - last update
about 1 year ago 30,100 pass - 🇳🇿New Zealand quietone
The Drupal Coding standards do not include the use of this tag. See Tag reference →
And if it is used it will not display correctly on api.drupal.org. One such case has already slipped in, https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Component%21Util....
If we want to use that feature we should have a Coding Standards issue to discuss it and, if approved, have api.drupal.org updated.
For now, I have tagged it and pinged the other Coding standards project maintainers.
- last update
about 1 year ago 30,135 pass - last update
about 1 year ago 30,135 pass - Status changed to Needs work
about 1 year ago 10:06am 4 September 2023 - 🇳🇿New Zealand quietone
I discussed this with catch, who pointed out that @template is already in core, There is an existing example, DeprecationHelper::backwardsCompatibleCall. We agreed to create an issue to add @template to api.drupal.org. I did that, 📌 Support @template Active .
We both agree that the name of the template should be meaningful, which 'T' is not. Also, the title suggests that this is adding information to the return type but the return type is not being changed. Therefor, also tagging for a title update.
I also don't want this issue to be a precedent for other issues to start adding @template. If we are going to do that for core, some planning will need to be done first..
- 🇬🇧United Kingdom longwave UK
Calling the template T when there is only one for a method is a pretty standard way of doing it.
The PHPStan docs use T: https://phpstan.org/blog/generics-in-php-using-phpdocs#type-variables
This has been inherited from Java generics which use T by default, or T1/T2/T3, or other single letters in some special cases: https://docs.oracle.com/javase/tutorial/java/generics/types.html
- 🇬🇧United Kingdom longwave UK
In order to not break the existing @param and @return docs I wonder if we should use the PHPStan-specific syntax here for now?
https://phpstan.org/blog/generics-in-php-using-phpdocs#ide-compatibility