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

Add test that passes

This commit is contained in:
Matthew Brown 2020-03-29 18:59:48 -04:00
parent 32d5c92428
commit 15c6778223

View File

@ -2586,6 +2586,35 @@ class ConditionalTest extends \Psalm\Tests\TestCase
use T;
}'
],
'smallConditional' => [
'<?php
class A {
public array $parts = [];
}
class FuncCall {
/** @var ?A */
public $name;
/** @var array<string> */
public $args = [];
}
function barr(FuncCall $function) : void {
if (!$function->name instanceof A) {
return;
}
if ($function->name->parts === ["function_exists"]
&& isset($function->args[0])
) {
// do something
} elseif ($function->name->parts === ["class_exists"]
&& isset($function->args[0])
) {
// do something else
}
}'
],
];
}