Extract template parameter names from `@template` tags in a docblock. Handles the common PHPStan / Psalm variants: - `@template T` - `@template TKey of array-key` - `@template-covariant TValue` - `@template-contravariant TValue` - `@phpstan-template T` - `@phpstan-template-covariant TValue` Returns a list of template parameter names (e.g. `["T", "TKey"]`).
(docblock: &str)
| 30 | /// |
| 31 | /// Returns a list of template parameter names (e.g. `["T", "TKey"]`). |
| 32 | pub fn extract_template_params(docblock: &str) -> Vec<String> { |
| 33 | extract_template_params_full(docblock) |
| 34 | .into_iter() |
| 35 | .map(|(name, _, _, _)| name) |
| 36 | .collect() |
| 37 | } |
| 38 | |
| 39 | /// Like [`extract_template_params`], but operates on a pre-parsed [`DocblockInfo`]. |
| 40 | pub fn extract_template_params_from_info(info: &DocblockInfo) -> Vec<String> { |