Function-level @template triggers 'Parameter tags must be defined first in a doc comment'

Created on 29 April 2024, about 2 months ago

Problem/Motivation

It seems odd to me to put a function-level @template at the end of the doc block, but if at the beginning it triggers:

ERROR: Parameter tags must be defined first in a doc comment

Steps to reproduce


/**
 * Returns an API decorator for the given client class.
 *
 * @template T
 *
 * @param class-string<T> $class
 *   The class to decorate.
 *
 * @return \Drupal\myapi\ApiDecorator<T>
 *   The decorator.
 */
function getDecorator(string $class): ApiDecorator {

Proposed resolution

Support having a @template before @param.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Active

Version

8.3

Component

Coder Sniffer

Created by

πŸ‡¬πŸ‡§United Kingdom AndyF

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024