1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Fix #1578 - fix empty array error

This commit is contained in:
Matthew Brown 2019-04-26 00:47:32 -04:00
parent dbcedd300b
commit 82e0bcafac
2 changed files with 22 additions and 1 deletions

View File

@ -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;
}
}

View File

@ -1796,6 +1796,27 @@ class FileManipulationTest extends TestCase
['PossiblyUnusedMethod'],
true,
],
'dontRemovePossiblyUnusedMethodWithCallUserFuncCall' => [
'<?php
class A {
public function foo() : void {}
}
function foo(A $a, string $var) {
call_user_func([$a, $var]);
}',
'<?php
class A {
public function foo() : void {}
}
function foo(A $a, string $var) {
call_user_func([$a, $var]);
}',
'7.1',
['PossiblyUnusedMethod'],
true,
],
'dontRemovePossiblyUnusedMethodWithVariableCallableLhsCall' => [
'<?php
class A {