From 45d058c2dd7c09ce13aa979f48f26f9eeff63320 Mon Sep 17 00:00:00 2001 From: orklah Date: Fri, 27 Nov 2020 15:10:55 +0100 Subject: [PATCH] better fix for reconciling iterable and object (#4712) --- src/Psalm/Internal/Type/SimpleAssertionReconciler.php | 2 +- tests/TypeReconciliation/ReconcilerTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Internal/Type/SimpleAssertionReconciler.php b/src/Psalm/Internal/Type/SimpleAssertionReconciler.php index 0022525b9..af4555c78 100644 --- a/src/Psalm/Internal/Type/SimpleAssertionReconciler.php +++ b/src/Psalm/Internal/Type/SimpleAssertionReconciler.php @@ -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 { diff --git a/tests/TypeReconciliation/ReconcilerTest.php b/tests/TypeReconciliation/ReconcilerTest.php index 157438288..6e6fafc8d 100644 --- a/tests/TypeReconciliation/ReconcilerTest.php +++ b/tests/TypeReconciliation/ReconcilerTest.php @@ -130,7 +130,7 @@ class ReconcilerTest extends \Psalm\Tests\TestCase 'traversableToIntersection' => ['Countable&Traversable', 'Traversable', 'Countable'], 'iterableWithoutParamsToTraversableWithoutParams' => ['Traversable', '!array', 'iterable'], 'iterableWithParamsToTraversableWithParams' => ['Traversable', '!array', 'iterable'], - 'iterableAndObject' => ['ArrayAccess', 'object', 'iterable'], + 'iterableAndObject' => ['Traversable', 'object', 'iterable'], 'iterableAndNotObject' => ['array', '!object', 'iterable'], ]; }