1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

better fix for reconciling iterable and object (#4712)

This commit is contained in:
orklah 2020-11-27 15:10:55 +01:00 committed by Daniil Gentili
parent 0b605d6b3c
commit 45d058c2dd
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 2 additions and 2 deletions

View File

@ -1213,7 +1213,7 @@ class SimpleAssertionReconciler extends \Psalm\Type\Reconciler
self::refineArrayKey($clone_type->type_params[0]);
$object_types[] = new Type\Atomic\TGenericObject('ArrayAccess', $clone_type->type_params);
$object_types[] = new Type\Atomic\TGenericObject('Traversable', $clone_type->type_params);
$did_remove_type = true;
} else {

View File

@ -130,7 +130,7 @@ class ReconcilerTest extends \Psalm\Tests\TestCase
'traversableToIntersection' => ['Countable&Traversable', 'Traversable', 'Countable'],
'iterableWithoutParamsToTraversableWithoutParams' => ['Traversable', '!array', 'iterable'],
'iterableWithParamsToTraversableWithParams' => ['Traversable<int, string>', '!array', 'iterable<int, string>'],
'iterableAndObject' => ['ArrayAccess<int, string>', 'object', 'iterable<int, string>'],
'iterableAndObject' => ['Traversable<int, string>', 'object', 'iterable<int, string>'],
'iterableAndNotObject' => ['array<int, string>', '!object', 'iterable<int, string>'],
];
}