Skip to content

Commit 4574528

Browse files
committed
add parenthesis
1 parent 35a2d24 commit 4574528

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/Rules/Functions/UselessFunctionReturnValueRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function processNode(Node $funcCall, Scope $scope): array
6464
if (count($reorderedArgs) === 1 || (count($reorderedArgs) >= 2 && $scope->getType($reorderedArgs[1]->value)->isFalse()->yes())) {
6565
return [RuleErrorBuilder::message(
6666
sprintf(
67-
'Return value of function %s is always true and the result is printed instead of being returned. Pass in true as parameter #%d $%s to return the output instead.',
67+
'Return value of function %s() is always true and the result is printed instead of being returned. Pass in true as parameter #%d $%s to return the output instead.',
6868
$functionReflection->getName(),
6969
2,
7070
$parametersAcceptor->getParameters()[1]->getName(),
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[
22
{
3-
"message": "Return value of function print_r is always true and the result is printed instead of being returned. Pass in true as parameter #2 $return to return the output instead.",
3+
"message": "Return value of function print_r() is always true and the result is printed instead of being returned. Pass in true as parameter #2 $return to return the output instead.",
44
"line": 38,
55
"ignorable": true
66
},
77
{
8-
"message": "Return value of function print_r is always true and the result is printed instead of being returned. Pass in true as parameter #2 $return to return the output instead.",
8+
"message": "Return value of function print_r() is always true and the result is printed instead of being returned. Pass in true as parameter #2 $return to return the output instead.",
99
"line": 89,
1010
"ignorable": true
1111
}
12-
]
12+
]

tests/PHPStan/Rules/Functions/UselessFunctionReturnValueRuleTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ public function testUselessReturnValue(): void
2323
{
2424
$this->analyse([__DIR__ . '/data/useless-fn-return.php'], [
2525
[
26-
'Return value of function print_r is always true and the result is printed instead of being returned. Pass in true as parameter #2 $return to return the output instead.',
26+
'Return value of function print_r() is always true and the result is printed instead of being returned. Pass in true as parameter #2 $return to return the output instead.',
2727
47,
2828
],
2929
[
30-
'Return value of function var_export is always true and the result is printed instead of being returned. Pass in true as parameter #2 $return to return the output instead.',
30+
'Return value of function var_export() is always true and the result is printed instead of being returned. Pass in true as parameter #2 $return to return the output instead.',
3131
56,
3232
],
3333
[
34-
'Return value of function print_r is always true and the result is printed instead of being returned. Pass in true as parameter #2 $return to return the output instead.',
34+
'Return value of function print_r() is always true and the result is printed instead of being returned. Pass in true as parameter #2 $return to return the output instead.',
3535
64,
3636
],
3737
]);
@@ -45,7 +45,7 @@ public function testUselessReturnValuePhp8(): void
4545

4646
$this->analyse([__DIR__ . '/data/useless-fn-return-php8.php'], [
4747
[
48-
'Return value of function print_r is always true and the result is printed instead of being returned. Pass in true as parameter #2 $return to return the output instead.',
48+
'Return value of function print_r() is always true and the result is printed instead of being returned. Pass in true as parameter #2 $return to return the output instead.',
4949
18,
5050
],
5151
]);

0 commit comments

Comments
 (0)