Problem/Motivation

DocBlock @method tags are used in the \Drupal\redis\ClientInterface to list redis commands that are passed to the underlying client library. Syntax of the @method tags is currently incorrect. Return type should be specified before the method name.

Current syntax:
@method get(string $key): string|mixed|false

Correct syntax:
@method string|mixed|false get(string $key)

Steps to reproduce

1. Consult the DocBlock documentation for @method tag

Syntax:
@method [[static] return type] [name]([[type] [parameter]<, ...>]) [<description>]

2. Run PHPStan with the level 2 or above. You get errors similar to this one:

PHPDoc tag @method has invalid value ((): void): Unexpected token "\n * ", expected type at offset 556 on line 12

Here is PHPStan report generated at the time of creating this issue: https://phpstan.org/r/d6a708e2-e6da-404c-9de9-207759803d6a

Proposed resolution

Fix the syntax.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork redis-3618496

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

vaish created an issue. See original summary.

vaish’s picture

Issue summary: View changes
Status: Active » Needs review
vaish’s picture

peri22’s picture

Status: Needs review » Reviewed & tested by the community
peri22’s picture

I can confirm this on '2.x' HEAD. The tags still use the trailing-colon form, and PHPDoc does indeed put the return type right before the method name.
'src/ClientInterface.php' is the only file that actually uses the '@method' tags, and every type has been carried over verbatim. Also, pipeline 931780 is fully green across all blocking jobs.
Given that this is only a docblock change, this is just a code review and not a functional verification by test. RTBC!