From 82e0bcafac723fdf5007a31a7ae74af1736c9f6f Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Fri, 26 Apr 2019 00:47:32 -0400 Subject: [PATCH] Fix #1578 - fix empty array error --- src/Psalm/Type/Union.php | 2 +- tests/FileManipulationTest.php | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Type/Union.php b/src/Psalm/Type/Union.php index 8d26489ba..ac6e1a250 100644 --- a/src/Psalm/Type/Union.php +++ b/src/Psalm/Type/Union.php @@ -1071,7 +1071,7 @@ class Union $new_generic_params = []; foreach ($extends_list as $key => $value) { - if (is_int($key)) { + if (is_string($key)) { $new_generic_params[] = $value; } } diff --git a/tests/FileManipulationTest.php b/tests/FileManipulationTest.php index 9a29866db..353964add 100644 --- a/tests/FileManipulationTest.php +++ b/tests/FileManipulationTest.php @@ -1796,6 +1796,27 @@ class FileManipulationTest extends TestCase ['PossiblyUnusedMethod'], true, ], + 'dontRemovePossiblyUnusedMethodWithCallUserFuncCall' => [ + ' [ '