Skip to content
Permalink
Browse files

Fix reconciliation of mixed to Traversable

  • Loading branch information...
muglug committed Aug 18, 2019
1 parent 1b983ba commit b8bdaea09a07657a13048ae45a580e9e708ed218
Showing with 11 additions and 1 deletion.
  1. +1 −1 src/Psalm/Internal/Type/AssertionReconciler.php
  2. +10 −0 tests/TypeReconciliationTest.php
@@ -1298,7 +1298,7 @@ private static function reconcileTraversable(
$existing_var_atomic_types = $existing_var_type->getTypes();
if ($existing_var_type->hasMixed() || $existing_var_type->hasTemplate()) {
return new Type\Union([new Type\Atomic\TIterable]);
return new Type\Union([new Type\Atomic\TNamedObject('Traversable')]);
}
$traversable_types = [];
@@ -1458,6 +1458,16 @@ function getBar(SimpleXMLElement $e, string $s) : void {
if (isset($e->bar)) {}
}',
],
'assertArrayOffsetToTraversable' => [
'<?php
function render(array $data): ?Traversable {
if ($data["o"] instanceof Traversable) {
return $data["o"];
}
return null;
}'
],
];
}

0 comments on commit b8bdaea

Please sign in to comment.
You can’t perform that action at this time.