Skip to content

Commit 8faf652

Browse files
authored
[TypeDeclarationDocblocks] Skip @ param mixed on AddParamArrayDocblockFromDataProviderRector (#7350)
* [TypeDeclarationDocblocks] Skip @param mixed on AddParamArrayDocblockFromDataProviderRector * fix
1 parent 9e917bd commit 8faf652

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Rector\Tests\TypeDeclarationDocblocks\Rector\ClassMethod\AddParamArrayDocblockFromDataProviderRector\Fixture;
6+
7+
use PHPUnit\Framework\Attributes\DataProvider;
8+
use PHPUnit\Framework\TestCase;
9+
10+
final class SkipMixedFromParamArray extends TestCase
11+
{
12+
#[DataProvider('provideData')]
13+
public function test(array $names): void
14+
{
15+
}
16+
17+
public static function provideData()
18+
{
19+
return [
20+
[$item],
21+
[$item2],
22+
];
23+
}
24+
}

rules/TypeDeclarationDocblocks/Rector/ClassMethod/AddParamArrayDocblockFromDataProviderRector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ public function refactor(Node $node): ?Node
151151
continue;
152152
}
153153

154+
if ($parameterType instanceof MixedType) {
155+
continue;
156+
}
157+
154158
$generalizedParameterType = $this->typeNormalizer->generalizeConstantTypes($parameterType);
155159

156160
$parameterTypeNode = $this->staticTypeMapper->mapPHPStanTypeToPHPStanPhpDocTypeNode(

0 commit comments

Comments
 (0)