Skip to content
Prev Previous commit
Next Next commit
fix ArrayType traversal
preserve array<*NEVER*, *NEVER*> -> array{} conversion
  • Loading branch information
jiripudil committed Sep 18, 2023
commit 4ce4f711bd197343b781c41b918fdc983f3fa0d0
4 changes: 4 additions & 0 deletions src/Type/ArrayType.php
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,10 @@ public function traverseWithVariance(TemplateTypeVariance $variance, callable $c
return $this;
}

if ($newKeyType instanceof NeverType && $newItemType instanceof NeverType) {
return new ConstantArrayType([], []);
}

return new self($newKeyType, $newItemType);
}

Expand Down