Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions rules/TypeDeclaration/NodeAnalyzer/CallTypesResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,16 @@ private function unionToSingleType(array $staticTypesByArgumentPosition, bool $r

if ($staticTypeByArgumentPosition[$position] instanceof UnionType) {
foreach ($staticTypeByArgumentPosition[$position]->getTypes() as $subType) {
// has another type over mixed is not allowed, even on native type
if ($subType instanceof MixedType) {
$staticTypeByArgumentPosition[$position] = new MixedType();
continue 2;
}

if ($removeMixedArray && $subType instanceof ArrayType && $this->isArrayMixedMixedType($subType)) {
$staticTypeByArgumentPosition[$position] = new MixedType();
continue 2;
}
}
}
}
Expand Down Expand Up @@ -228,14 +234,6 @@ private function isEmptyArray(Expr $expr): bool
private function isArrayMixedMixedType(Type $type): bool
{
if (! $type instanceof ArrayType) {
if ($type instanceof UnionType) {
foreach ($type->getTypes() as $subType) {
if ($subType instanceof ArrayType && $this->isArrayMixedMixedType($subType)) {
return true;
}
}
}

return false;
}

Expand Down
Loading