Ejemplo n.º 1
0
 /**
  * オーバーライド
  */
 public function getParameters()
 {
     $params = [];
     foreach (parent::getParameters() as $p) {
         $params[] = new ReflectionParameter([$p->getDeclaringClass()->getName(), $p->getDeclaringFunction()->getName()], $p->getName());
     }
     return $params;
 }
Ejemplo n.º 2
0
 /**
  * DocCommentを取得する
  *
  * @param mixed $object
  * @return string 
  */
 public static function getDocCommentRaw($object)
 {
     if ($object instanceof ReflectionMethod || $object instanceof ReflectionClass || $object instanceof ReflectionFunction || $object instanceof Injection\Spec) {
         return $object->getDocComment();
     }
     // オブジェクトを判定
     if (is_callable($object) && is_array($object)) {
         $rs = new ReflectionMethod($object[0], $object[1]);
         return $rs->getDocComment();
     }
     if ($object instanceof Closure) {
         $rs = new ReflectionFunction($object);
         return $rs->getDocComment();
     }
     if (is_array($object) && is_callable($object[count($object) - 1])) {
         return self::getDocCommentRaw($object[count($object) - 1]);
     }
     if (is_object($object)) {
         $rs = new ReflectionClass($object);
         return $rs->getDocComment();
     }
     throw new Exception\CantRetriveDocComment($object);
 }