mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Try
This commit is contained in:
parent
dc977964c6
commit
fbaf6afb30
@ -32,10 +32,16 @@ class CanContainObjectTypeVisitor extends NodeVisitor
|
||||
{
|
||||
if (
|
||||
$type instanceof Union
|
||||
&& UnionTypeComparator::canBeContainedBy($this->codebase, $type, new Union([new TObject()]))
|
||||
&& (
|
||||
UnionTypeComparator::canBeContainedBy($this->codebase, new Union([new TObject()]), $type)
|
||||
&& UnionTypeComparator::canBeContainedBy($this->codebase, $type, new Union([new TObject()]))
|
||||
)
|
||||
||
|
||||
$type instanceof Atomic
|
||||
&& AtomicTypeComparator::isContainedBy($this->codebase, $type, new TObject())
|
||||
&& (
|
||||
AtomicTypeComparator::isContainedBy($this->codebase, new TObject(), $type)
|
||||
|| AtomicTypeComparator::isContainedBy($this->codebase, $type, new TObject())
|
||||
)
|
||||
) {
|
||||
$this->contains_object_type = true;
|
||||
return NodeVisitor::STOP_TRAVERSAL;
|
||||
|
@ -751,12 +751,14 @@ class UnusedCodeTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
function test(Foo|int $foo): bool {
|
||||
function test(Foo|int $foo, mixed $bar, iterable $baz): bool {
|
||||
try {
|
||||
serialize(new Foo());
|
||||
serialize([new Foo()]);
|
||||
serialize([[new Foo()]]);
|
||||
serialize($foo);
|
||||
serialize($bar);
|
||||
serialize($baz);
|
||||
unserialize("");
|
||||
} catch (\Throwable) {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user