diff --git a/rules-tests/TypeDeclarationDocblocks/Rector/Class_/ClassMethodArrayDocblockParamFromLocalCallsRector/Fixture/skip_union_mixed_array.php.inc b/rules-tests/TypeDeclarationDocblocks/Rector/Class_/ClassMethodArrayDocblockParamFromLocalCallsRector/Fixture/skip_union_mixed_array.php.inc new file mode 100644 index 00000000000..4218fc66e20 --- /dev/null +++ b/rules-tests/TypeDeclarationDocblocks/Rector/Class_/ClassMethodArrayDocblockParamFromLocalCallsRector/Fixture/skip_union_mixed_array.php.inc @@ -0,0 +1,15 @@ +exec($_SERVER['argv'] ?? []); + } + + private function exec(array $argv) + { + } +} \ No newline at end of file diff --git a/rules/TypeDeclaration/NodeAnalyzer/CallTypesResolver.php b/rules/TypeDeclaration/NodeAnalyzer/CallTypesResolver.php index 1dff26fafb2..68ae54b0fcb 100644 --- a/rules/TypeDeclaration/NodeAnalyzer/CallTypesResolver.php +++ b/rules/TypeDeclaration/NodeAnalyzer/CallTypesResolver.php @@ -135,6 +135,15 @@ private function unionToSingleType(array $staticTypesByArgumentPosition, bool $r if ($staticTypeByArgumentPosition[$position]->isNull()->yes()) { $staticTypeByArgumentPosition[$position] = new MixedType(); } + + if ($staticTypeByArgumentPosition[$position] instanceof UnionType) { + foreach ($staticTypeByArgumentPosition[$position]->getTypes() as $subType) { + if ($subType instanceof MixedType) { + $staticTypeByArgumentPosition[$position] = new MixedType(); + continue 2; + } + } + } } return $staticTypeByArgumentPosition;