示例#1
0
 private String getParamType(PHPDocBlock docBlock, String paramName, String defaultType) {
   String result = defaultType;
   if (docBlock != null) {
     for (PHPDocTag tag : docBlock.getTags(PHPDocTag.PARAM)) {
       if (tag.isValidParamTag() && tag.getVariableReference().getName().equals(paramName)) {
         String typeNames = tag.getSingleTypeReference().getName();
         result = typeNames.replace(Constants.TYPE_SEPERATOR_CHAR, Constants.DOT);
         break;
       }
     }
   }
   return result;
 }
 private String[] processParameterTypes(MethodDeclaration methodDeclaration) {
   List<?> args = methodDeclaration.getArguments();
   PHPDocBlock docBlock = ((PHPMethodDeclaration) methodDeclaration).getPHPDoc();
   String[] parameterType = new String[args.size()];
   for (int a = 0; a < args.size(); a++) {
     Argument arg = (Argument) args.get(a);
     if (arg instanceof FormalParameter) {
       SimpleReference type = ((FormalParameter) arg).getParameterType();
       if (type != null) {
         parameterType[a] = type.getName();
       } else if (docBlock != null) {
         for (PHPDocTag tag : docBlock.getTags(PHPDocTag.PARAM)) {
           if (tag.isValidParamTag()
               && tag.getVariableReference().getName().equals(arg.getName())) {
             parameterType[a] = tag.getSingleTypeReference().getName();
             break;
           }
         }
       }
     }
   }
   return parameterType;
 }