public function test_MethodCall_alternatives() { $method = (new Method())->setDocReturnType(Type::int_())->setStatic(false); $refl = $this->getMockBuilder(Reflection::class)->disableOriginalConstructor()->getMock(); $refl->expects($this->once())->method('findMethod')->with($this->equalTo('\\C'), $this->equalTo('f'))->willReturn($method); $var1 = new Expr\Variable('a', ['type' => Type::alternatives([Type::bool_(), Type::object_('\\C')])]); $expr = new Expr\MethodCall($var1, 'f'); $this->infer([$expr], $refl); $this->assertTrue($expr->getAttribute('type')->equals(Type::int_())); }