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

Fix callable negation

This commit is contained in:
Matthew Brown 2021-12-18 19:42:43 +00:00
parent 3df758d75f
commit 2e32a18222
2 changed files with 8 additions and 5 deletions

View File

@ -376,7 +376,8 @@ abstract class Atomic implements TypeNode
|| $this instanceof TCallableString
|| $this instanceof TCallableArray
|| $this instanceof TCallableList
|| $this instanceof TCallableKeyedArray;
|| $this instanceof TCallableKeyedArray
|| $this instanceof TClosure;
}
public function isIterable(Codebase $codebase): bool

View File

@ -971,14 +971,16 @@ class ConditionalTest extends TestCase
}
strlen($a);',
],
'removeCallable' => [
'removeCallableString' => [
'<?php
$s = rand(0,1) ? "strlen" : [1];
if (!is_callable($s)) {
array_pop($s);
}
$a = rand(0, 1) ? (function(): void {}) : 1.1;
}',
],
'removeCallableClosure' => [
'<?php
$a = rand(0, 1) ? (function(): void {}) : 1;
if (!is_callable($a)) {
echo $a;
}',