Пример #1
0
 public function testResolveParams()
 {
     $input = array($this->manager->describe('ClassF'), 'test string');
     $params = $this->manager->resolveParams($input);
     $this->assertInstanceOf('ClassF', $params[0]);
     $this->assertEquals($input[1], $params[1]);
 }
Пример #2
0
 /**
  * @param \ReflectionParameter $param
  *
  * @throws Exception\RuntimeException
  * @return mixed
  */
 protected function resolveArgumentValue(\ReflectionParameter $param)
 {
     $paramClass = null;
     try {
         $paramClass = $param->getClass();
     } catch (\ReflectionException $e) {
     }
     if (!$paramClass instanceof ReflectionClass || $param->isDefaultValueAvailable()) {
         return $this->resolveArgumentDefaultValue($param);
     }
     if (!$this->manager instanceof Manager) {
         throw new RuntimeException("Unable to retrieve descriptor for class '{$paramClass->getName()}' " . "because the manager has not been set. Please use Descriptor::setManager to resolve this.");
     }
     return $this->manager->describe($paramClass->getName(), null, null, $paramClass);
 }