Skip to content

Commit 46530d5

Browse files
committed
Fixed some phpDocs
1 parent af49d1e commit 46530d5

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

Diff for: phpstan.neon

-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,3 @@ parameters:
1010
- */tests/*/ExampleController.php
1111
- */tests/*/ExampleServiceSubscriber.php
1212
- */tests/*/request_get_content.php
13-
ignoreErrors:
14-
- '~^Parameter \#1 \$node \(.*\) of method .*Rule::processNode\(\) should be contravariant with parameter \$node \(PhpParser\\Node\) of method PHPStan\\Rules\\Rule::processNode\(\)$~'
15-
- '~^Parameter \#2 \$default of method Symfony\\Component\\HttpFoundation\\HeaderBag::get\(\) expects string\|null, array<int, string> given\.$~'
16-
reportUnmatchedIgnoredErrors: false

Diff for: src/Rules/Symfony/ContainerInterfacePrivateServiceRule.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use PhpParser\Node\Expr\MethodCall;
77
use PHPStan\Analyser\Scope;
88
use PHPStan\Rules\Rule;
9+
use PHPStan\ShouldNotHappenException;
910
use PHPStan\Symfony\ServiceMap;
1011
use PHPStan\Type\ObjectType;
1112
use function sprintf;
@@ -27,12 +28,16 @@ public function getNodeType(): string
2728
}
2829

2930
/**
30-
* @param MethodCall $node
31-
* @param Scope $scope
32-
* @return string[]
31+
* @param \PhpParser\Node $node
32+
* @param \PHPStan\Analyser\Scope $scope
33+
* @return (string|\PHPStan\Rules\RuleError)[] errors
3334
*/
3435
public function processNode(Node $node, Scope $scope): array
3536
{
37+
if (!$node instanceof MethodCall) {
38+
throw new ShouldNotHappenException();
39+
}
40+
3641
if (!$node->name instanceof Node\Identifier) {
3742
return [];
3843
}

Diff for: src/Rules/Symfony/ContainerInterfaceUnknownServiceRule.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use PhpParser\PrettyPrinter\Standard;
88
use PHPStan\Analyser\Scope;
99
use PHPStan\Rules\Rule;
10+
use PHPStan\ShouldNotHappenException;
1011
use PHPStan\Symfony\ServiceMap;
1112
use PHPStan\Type\ObjectType;
1213
use PHPStan\Type\Symfony\Helper;
@@ -32,12 +33,16 @@ public function getNodeType(): string
3233
}
3334

3435
/**
35-
* @param MethodCall $node
36-
* @param Scope $scope
37-
* @return string[]
36+
* @param \PhpParser\Node $node
37+
* @param \PHPStan\Analyser\Scope $scope
38+
* @return (string|\PHPStan\Rules\RuleError)[] errors
3839
*/
3940
public function processNode(Node $node, Scope $scope): array
4041
{
42+
if (!$node instanceof MethodCall) {
43+
throw new ShouldNotHappenException();
44+
}
45+
4146
if (!$node->name instanceof Node\Identifier) {
4247
return [];
4348
}

0 commit comments

Comments
 (0)