Skip to content

Commit 9067514

Browse files
committed
Allow omitting useless @param and @return docblocks
If PHP type declarations can be used to describe the type of a parameter or return value, we shouldn't have to duplicate this in a docblock annotation.
1 parent 01a4419 commit 9067514

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/LEVIY/ruleset.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
</rule>
163163
<rule ref="Symfony.Commenting.FunctionComment">
164164
<exclude name="Symfony.Commenting.FunctionComment.MissingParamComment"/>
165+
<exclude name="Symfony.Commenting.FunctionComment.ParamNameNoMatch"/>
165166
<exclude name="Symfony.Commenting.FunctionComment.SpacingAfterParamName"/>
166167
</rule>
167168
<rule ref="Symfony.Formatting.BlankLineBeforeReturn"/>

tests/correct/annotations.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,17 @@
77
function allUsefulAnnotationsAreAllowed(): void
88
{
99
}
10+
11+
/**
12+
* @param int[] $numbers
13+
*/
14+
function omittingUselessReturnAnnotationsIsAllowed(array $numbers): void
15+
{
16+
}
17+
18+
/**
19+
* @param int[] $numbers
20+
*/
21+
function omittingUselessParamAnnotationsIsAllowed(string $string, int $int, array $numbers, bool $bool): void
22+
{
23+
}

0 commit comments

Comments
 (0)