Skip to content

Commit 98c1d3a

Browse files
authored
avoid spreadding mixed type in ClassMethodArrayDocblockParamFromLocalCallsRector (#7335)
1 parent 7d55272 commit 98c1d3a

File tree

3 files changed

+19
-40
lines changed

3 files changed

+19
-40
lines changed

rules-tests/TypeDeclarationDocblocks/Rector/Class_/ClassMethodArrayDocblockParamFromLocalCallsRector/Fixture/mixed_from_unserialize.php.inc

Lines changed: 0 additions & 40 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace Rector\Tests\TypeDeclarationDocblocks\Rector\Class_\ClassMethodArrayDocblockParamFromLocalCallsRector\Fixture;
4+
5+
final class SkipMixed
6+
{
7+
public function go(array $mixed)
8+
{
9+
$this->run($mixed);
10+
}
11+
12+
private function run(array $items)
13+
{
14+
}
15+
}

rules/TypeDeclarationDocblocks/Rector/Class_/ClassMethodArrayDocblockParamFromLocalCallsRector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use PhpParser\Node;
88
use PhpParser\Node\Stmt\Class_;
99
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
10+
use PHPStan\Type\MixedType;
1011
use PHPStan\Type\Type;
1112
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
1213
use Rector\PhpParser\NodeFinder\LocalMethodCallFinder;
@@ -111,6 +112,9 @@ public function refactor(Node $node): ?Node
111112
if (! $resolvedParameterType instanceof Type) {
112113
continue;
113114
}
115+
if ($resolvedParameterType instanceof MixedType) {
116+
continue;
117+
}
114118

115119
$hasClassMethodChanged = $this->nodeDocblockTypeDecorator->decorateGenericIterableParamType(
116120
$resolvedParameterType,

0 commit comments

Comments
 (0)