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
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
Comment #3
vaish commentedComment #4
vaish commentedPHPStan errors are now fixed: https://phpstan.org/r/520d7a84-390d-45e6-b22f-06dd56d14f46
Comment #5
peri22 commentedComment #6
peri22 commentedI 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!