BetterReflectionTest\Reflection\ReflectionFunctionAbstractTest::testSetReturnType PHP Метод

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

public testSetReturnType ( )
    public function testSetReturnType()
    {
        $reflector = new FunctionReflector(new SingleFileSourceLocator(__DIR__ . '/../Fixture/Php7ReturnTypeDeclarations.php'));
        $functionInfo = $reflector->reflect('returnsString');
        $functionInfo->setReturnType(new Integer());
        $this->assertSame('int', (string) $functionInfo->getReturnType());
        $this->assertStringStartsWith('function returnsString() : int', (new StandardPrettyPrinter())->prettyPrint([$functionInfo->getAst()]));
    }