Extract template parameter names, optional upper bounds, **and** variance from `@template` tags in a docblock. Returns a list of `(name, optional_bound, variance)` tuples: - `@template T` → `("T", None, Invariant)` - `@template TNode of PDependNode` → `("TNode", Some("PDependNode"), Invariant)` - `@template-covariant TValue` → `("TValue", None, Covariant)` - `@template-contravariant TInput of Foo
(
docblock: &str,
)
| 79 | /// - `@template-covariant TValue` → `("TValue", None, Covariant)` |
| 80 | /// - `@template-contravariant TInput of Foo` → `("TInput", Some("Foo"), Contravariant)` |
| 81 | pub fn extract_template_params_full( |
| 82 | docblock: &str, |
| 83 | ) -> Vec<(String, Option<PhpType>, TemplateVariance, Option<PhpType>)> { |
| 84 | let Some(info) = parse_docblock_for_tags(docblock) else { |
| 85 | return Vec::new(); |
| 86 | }; |
| 87 | extract_template_params_full_from_info(&info) |
| 88 | } |
| 89 | |
| 90 | /// Map a `TagKind` to the corresponding `TemplateVariance`. |
| 91 | pub(crate) const fn variance_for(kind: TagKind) -> TemplateVariance { |