BetterReflectionTest\Reflection\ReflectionParameterTest::testSetType PHP Метод

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

public testSetType ( )
    public function testSetType()
    {
        $classInfo = $this->reflector->reflect(Php7ParameterTypeDeclarations::class);
        $methodInfo = $classInfo->getMethod('foo');
        $parameterInfo = $methodInfo->getParameter('intParam');
        $parameterInfo->setType(new Types\String_());
        $this->assertSame('string', (string) $parameterInfo->getType());
        $this->assertStringStartsWith('public function foo(string $intParam', (new StandardPrettyPrinter())->prettyPrint([$methodInfo->getAst()]));
    }