PhpParser\Builder\ParamTest::testTypeHints PHP Method

testTypeHints() public method

public testTypeHints ( $typeHint, $expectedType )
    public function testTypeHints($typeHint, $expectedType)
    {
        $node = $this->createParamBuilder('test')->setTypeHint($typeHint)->getNode();
        $type = $node->type;
        /* Manually implement comparison to avoid __toString stupidity */
        if ($expectedType instanceof Node\NullableType) {
            $this->assertInstanceOf(get_class($expectedType), $type);
            $expectedType = $expectedType->type;
            $type = $type->type;
        }
        if ($expectedType instanceof Node\Name) {
            $this->assertInstanceOf(get_class($expectedType), $type);
            $this->assertEquals($expectedType, $type);
        } else {
            $this->assertSame($expectedType, $type);
        }
    }