/** * @param $name * @return \PHPDocsMD\ClassEntity */ private function getClassEntity($name) { if (!isset($this->memory[$name])) { $reflector = new Reflector($name); $this->memory[$name] = $reflector->getClassEntity(); } return $this->memory[$name]; }
function testParams() { $paramA = new ReflectionParameter(array('Acme\\ExampleClass', 'funcD'), 2); $paramB = new ReflectionParameter(array('Acme\\ExampleClass', 'funcD'), 3); $paramC = new ReflectionParameter(array('Acme\\ExampleClass', 'funcD'), 0); $typeA = \PHPDocsMD\Reflector::getParamType($paramA); $typeB = \PHPDocsMD\Reflector::getParamType($paramB); $typeC = \PHPDocsMD\Reflector::getParamType($paramC); $this->assertEmpty($typeC); $this->assertEquals('\\stdClass', $typeB); $this->assertEquals('\\Acme\\ExampleInterface', $typeA); $functions = $this->class->getFunctions(); $params = $functions[2]->getParams(); $this->assertTrue($functions[2]->hasParams()); $this->assertFalse($functions[5]->hasParams()); $this->assertEquals(4, count($params)); $this->assertEquals(false, $params[0]->getDefault()); $this->assertEquals('$arg', $params[0]->getName()); $this->assertEquals('mixed', $params[0]->getType()); $this->assertEquals('array()', $params[1]->getDefault()); $this->assertEquals('$arr', $params[1]->getName()); $this->assertEquals('array', $params[1]->getType()); $this->assertEquals('null', $params[2]->getDefault()); $this->assertEquals('$depr', $params[2]->getName()); $this->assertEquals('\\Acme\\ExampleInterface', $params[2]->getType()); }