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:
parent
32d5c92428
commit
15c6778223
@ -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
|
||||
}
|
||||
}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user