mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Try
This commit is contained in:
parent
dc977964c6
commit
fbaf6afb30
@ -32,10 +32,16 @@ class CanContainObjectTypeVisitor extends NodeVisitor
|
|||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
$type instanceof Union
|
$type instanceof Union
|
||||||
|
&& (
|
||||||
|
UnionTypeComparator::canBeContainedBy($this->codebase, new Union([new TObject()]), $type)
|
||||||
&& UnionTypeComparator::canBeContainedBy($this->codebase, $type, new Union([new TObject()]))
|
&& UnionTypeComparator::canBeContainedBy($this->codebase, $type, new Union([new TObject()]))
|
||||||
|
)
|
||||||
||
|
||
|
||||||
$type instanceof Atomic
|
$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;
|
$this->contains_object_type = true;
|
||||||
return NodeVisitor::STOP_TRAVERSAL;
|
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 {
|
try {
|
||||||
serialize(new Foo());
|
serialize(new Foo());
|
||||||
serialize([new Foo()]);
|
serialize([new Foo()]);
|
||||||
serialize([[new Foo()]]);
|
serialize([[new Foo()]]);
|
||||||
serialize($foo);
|
serialize($foo);
|
||||||
|
serialize($bar);
|
||||||
|
serialize($baz);
|
||||||
unserialize("");
|
unserialize("");
|
||||||
} catch (\Throwable) {
|
} catch (\Throwable) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user