Esempio n. 1
0
 private function reflectMethodToNode(ReflectionMethod $method, Node\ClassNode $classNode)
 {
     $node = new Node\MethodNode($method->getName());
     if (true === $method->isProtected()) {
         $node->setVisibility('protected');
     }
     if (true === $method->isStatic()) {
         $node->setStatic();
     }
     if (true === $method->returnsReference()) {
         $node->setReturnsReference();
     }
     if (version_compare(PHP_VERSION, '7.0', '>=') && true === $method->hasReturnType()) {
         $node->setReturnType((string) $method->getReturnType());
     }
     if (is_array($params = $method->getParameters()) && count($params)) {
         foreach ($params as $param) {
             $this->reflectArgumentToNode($param, $node);
         }
     }
     $classNode->addMethod($node);
 }