Pinq\Tests\Integration\Analysis\TypeSystemTest::testCompositeType PHP Метод

testCompositeType() публичный Метод

public testCompositeType ( )
    public function testCompositeType()
    {
        $compositeType = $this->typeSystem->getType(TypeId::getComposite([TypeId::getObject('ArrayAccess'), TypeId::getObject('Countable')]));
        $indexer = $compositeType->getIndex(O\Expression::index(O\Expression::value([]), O\Expression::value('s')));
        $this->assertEqualTypes($this->typeSystem->getObjectType('ArrayAccess'), $indexer->getSourceType());
        $this->assertEqualsNativeType(INativeType::TYPE_MIXED, $indexer->getReturnType());
        $method = $compositeType->getMethod(O\Expression::methodCall(O\Expression::value([]), O\Expression::value('offsetExists')));
        $this->assertEqualTypes($this->typeSystem->getObjectType('ArrayAccess'), $method->getSourceType());
        $this->assertEqualsNativeType(INativeType::TYPE_BOOL, $method->getReturnType());
        $method = $compositeType->getMethod(O\Expression::methodCall(O\Expression::value([]), O\Expression::value('count')));
        $this->assertEqualTypes($this->typeSystem->getObjectType('Countable'), $method->getSourceType());
        $this->assertEqualsNativeType(INativeType::TYPE_INT, $method->getReturnType());
    }