dox Executable Documentation

Method analyzer

Unknown type

$method = new MethodAnalyzer(new \ReflectionMethod(MethodAnalyzerTest_Foo::$CLASS, 'first'));
$this->assertEquals($method->getTypes(new TypeFactory()), array('one' => new UnknownType()));

Primitive and class type

$method = new MethodAnalyzer(new \ReflectionMethod(MethodAnalyzerTest_Foo::$CLASS, 'second'));
$this->assertEquals($method->getTypes(new TypeFactory()), array('one' => new StringType(), 'two' => new ClassType('DateTime'), 'three' => new ClassType('DateTime')));

Nullable types

$method = new MethodAnalyzer(new \ReflectionMethod(MethodAnalyzerTest_Foo::$CLASS, 'third'));
$this->assertEquals($method->getTypes(new TypeFactory()), array('one' => new NullableType(new UnknownType()), 'two' => new NullableType(new StringType()), 'three' => new NullableType(new ClassType('DateTime'))));

Read comment

$method = new MethodAnalyzer(new \ReflectionMethod(MethodAnalyzerTest_Foo::$CLASS, 'fourth'));
$this->assertEquals($method->getComments(), array('one' => null, 'two' => 'With Comment'));