Exemplo n.º 1
0
 /**
  * @param Method|Property                $member
  * @param Stmt\ClassMethod|Stmt\Property $node
  * @param ClassLike                      $class  Class member is defined in.
  *
  * @return 
  */
 protected function processMember($member, Node $node, ClassLike $class)
 {
     $member->setAccessibility($node->isPrivate() ? ClassLike::M_PRIVATE : ($node->isProtected() ? ClassLike::M_PROTECTED : ClassLike::M_PUBLIC));
     $member->setStatic($node->isStatic());
     $member->setClass($class);
 }
Exemplo n.º 2
0
 /**
  * @param Method[] $methods
  * @param Method   $method
  */
 protected function mergeMethod(array &$methods, Method $method)
 {
     // TODO: Do a better job here?
     $method->setDocReturnType(Type::alternatives([$method->getDocReturnType(), $method->getReturnType()]));
     $params = [];
     foreach ($method->getParams() as $param) {
         $param->setDocType(Type::alternatives([$param->getDocType(), $param->getTypeHint()]));
         $params[$param->getName()] = $param;
     }
     if (isset($methods[strtolower($method->getName())])) {
         $baseMethod = $methods[strtolower($method->getName())];
         $method->setDocReturnType(Type::alternatives([$method->getDocReturnType(), $baseMethod->getDocReturnType()]));
         foreach ($baseMethod->getParams() as $baseParam) {
             if (array_key_exists($baseParam->getName(), $params)) {
                 $param = $params[$baseParam->getName()];
                 $param->setDocType(Type::alternatives([$param->getDocType(), $baseParam->getDocType()]));
             }
         }
     }
     $methods[strtolower($method->getName())] = $method;
 }