Examples of PHPClassType


Examples of org.eclipse.php.internal.core.typeinference.PHPClassType

      IType currentNamespace) {
    IEvaluatedType type = PHPSimpleTypes.fromString(typeName);
    if (type == null) {
      if (typeName.indexOf(NamespaceReference.NAMESPACE_SEPARATOR) != -1
          || currentNamespace == null) {
        type = new PHPClassType(typeName);
      } else if (currentNamespace != null) {
        type = new PHPClassType(currentNamespace.getElementName(),
            typeName);       
      }
    }
    return type;
  }
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.PHPClassType

          typeName = fullName;
        }
      }
    }
    return PHPTypeInferenceUtils.getModelElements(
        new PHPClassType(typeName), (ISourceModuleContext) context,
        offset);
  }
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.PHPClassType

              moduleDeclaration, offset);
          if (context instanceof MethodContext) {
            IEvaluatedType instanceType = ((MethodContext) context)
                .getInstanceType();
            if (instanceType instanceof PHPClassType) {
              PHPClassType classType = (PHPClassType) instanceType;
              String namespace = classType.getNamespace();
              if (namespace != null && namespace.length() > 0) {
                String typeName = classType.getTypeName();
                int i = typeName
                    .lastIndexOf(NamespaceReference.NAMESPACE_SEPARATOR);
                if (i != -1) {
                  typeName = typeName.substring(i + 1);
                }
                if (namespace.charAt(0) == NamespaceReference.NAMESPACE_SEPARATOR) {
                  namespace = namespace.substring(1);
                }
                IType currentNamespace = PHPModelUtils
                    .getCurrentNamespace(types[0]);
                if (currentNamespace != null) {
                  isThis = namespace.equals(currentNamespace
                      .getElementName())
                      && typeName.equals(types[0]
                          .getElementName());
                }
              } else {
                isThis = classType.getTypeName().equals(
                    types[0].getElementName());
              }
            }
          }
        }
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.PHPClassType

              moduleDeclaration, offset);
          if (context instanceof MethodContext) {
            IEvaluatedType instanceType = ((MethodContext) context)
                .getInstanceType();
            if (instanceType instanceof PHPClassType) {
              PHPClassType classType = (PHPClassType) instanceType;
              String typeName = classType.getTypeName();
              String namespace = classType.getNamespace();
              if (namespace != null && namespace.length() > 0) {
                int i = typeName
                    .lastIndexOf(NamespaceReference.NAMESPACE_SEPARATOR);
                if (i != -1) {
                  typeName = typeName.substring(i + 1);
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.PHPClassType

                .getDeclaringTypeName();
            if (declaringTypeName != null) {
              IEvaluatedType resolved = PHPSimpleTypes
                  .fromString(declaringTypeName);
              if (resolved == null) {
                return new PHPClassType(declaringTypeName);
              }
            }
          }
        }
      }
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.PHPClassType

        fileContext.setNamespace(node.getName());
      }
    } else {
      ISourceModuleContext parentContext = (ISourceModuleContext) contextStack
          .peek();
      PHPClassType instanceType;
      if (parentContext instanceof INamespaceContext
          && ((INamespaceContext) parentContext).getNamespace() != null) {
        if (node instanceof TraitDeclaration) {
          instanceType = new PHPTraitType(
              ((INamespaceContext) parentContext).getNamespace(),
              node.getName());
        } else {
          instanceType = new PHPClassType(
              ((INamespaceContext) parentContext).getNamespace(),
              node.getName());
        }
      } else {
        if (node instanceof TraitDeclaration) {
          if (declaringType != null
              && realType != null
              && declaringType.getElementName().equals(
                  node.getName())) {
            if (realType.getParent() instanceof IType) {
              IType ns = (IType) realType.getParent();
              instanceType = new PHPThisClassType(
                  ns.getElementName(),
                  realType.getElementName(), realType);
            } else {
              instanceType = new PHPThisClassType(
                  realType.getElementName(), realType);
            }
          } else {
            instanceType = new PHPTraitType(node.getName());
          }
        } else {
          instanceType = new PHPClassType(node.getName());
        }
      }

      contextStack.push(new TypeContext(parentContext, instanceType));
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.PHPClassType

  public IGoal[] subGoalDone(IGoal subgoal, Object result, GoalState state) {
    if (result instanceof PHPClassType) {
      this.result = (PHPClassType) result;
    } else {
      this.result = new PHPClassType("StdClass"); //$NON-NLS-1$
    }
    return IGoal.NO_GOALS;
  }
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.PHPClassType

    super(goal);
    Class<?> expressionClass = declare.getClass();
    if (expressionClass == TraitDeclaration.class) {
      result = new PHPTraitType(declare.getName());
    } else {
      result = new PHPClassType(declare.getName());
    }

  }
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.PHPClassType

                        .fromString(typeName);
                    if (type == null) {
                      if (typeName
                          .indexOf(NamespaceReference.NAMESPACE_SEPARATOR) != -1
                          || currentNamespace == null) {
                        type = new PHPClassType(
                            typeName);
                      } else {
                        type = new PHPClassType(
                            currentNamespace
                                .getElementName(),
                            typeName);
                      }
                    }

                    types.add(type);
                  }
                  // if (namespace == null
                  // || namespace.getName().equals("")) {
                  // types.add(new PHPClassType(reference
                  // .getName()));
                  // } else {
                  // types.add(new
                  // PHPClassType(namespace.getName(),
                  // reference.getName()));
                  // }

                }
                found = true;
              }
              return !found;
            }

            public boolean visit(TypeDeclaration s)
                throws Exception {
              this.currentType = s;
              return !found;
            }

            public boolean endvisit(TypeDeclaration s)
                throws Exception {
              this.currentType = null;
              return super.endvisit(s);
            }

            public boolean visit(ASTNode n) throws Exception {
              return !found;
            }
          });
        } catch (Exception e) {
          if (DLTKCore.DEBUG) {
            e.printStackTrace();
          }
        }

        if (types.size() == 1) {
          result = types.get(0);
        } else if (types.size() > 1) {
          result = new AmbiguousType(
              types.toArray(new IEvaluatedType[types.size()]));
        }
      }
    } else {
      String parentNamespace = null;

      // Check current context - if we are under some namespace:
      if (context instanceof INamespaceContext) {
        parentNamespace = ((INamespaceContext) context).getNamespace();
      }
      String fullyQualifiedName;
      // If the namespace was prefixed explicitly - use it:
      if (typeReference instanceof FullyQualifiedReference) {
        fullyQualifiedName = ((FullyQualifiedReference) typeReference)
            .getFullyQualifiedName();
      } else {
        fullyQualifiedName = typeReference.getName();
        className = PHPModelUtils
            .extractElementName(fullyQualifiedName);
      }
      ISourceModule sourceModule = ((ISourceModuleContext) context)
          .getSourceModule();
      int offset = typeReference.sourceStart();
      String extractedNamespace = PHPModelUtils.extractNamespaceName(
          fullyQualifiedName, sourceModule, offset);
      if (extractedNamespace != null) {
        parentNamespace = extractedNamespace;
        className = PHPModelUtils.getRealName(fullyQualifiedName,
            sourceModule, offset, className);
      }
      if (PHPModelUtils.isInUseTraitStatement(
          ((ISourceModuleContext) context).getRootNode(),
          typeReference.sourceStart())) {
        if (parentNamespace != null) {
          result = new PHPTraitType(parentNamespace, className);
        } else {
          result = new PHPTraitType(className);
        }
      } else {
        if (parentNamespace != null) {
          result = new PHPClassType(parentNamespace, className);
        } else {
          result = new PHPClassType(className);
        }
      }
    }

    return IGoal.NO_GOALS;
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.PHPClassType

        return IGoal.NO_GOALS;
      } else if (result instanceof PHPClassType) {
        if (subgoal instanceof ExpressionTypeGoal) {
          ISourceModule sourceModule = ((ISourceModuleContext) subgoal
              .getContext()).getSourceModule();
          PHPClassType classType = (PHPClassType) result;
          List<IGoal> subGoals = new LinkedList<IGoal>();
          try {
            IType[] types = PHPModelUtils.getTypes(
                classType.getTypeName(), sourceModule, 0,
                cache, null);
            for (IType type : types) {
              IType[] superTypes = PHPModelUtils.getSuperClasses(
                  type,
                  cache == null ? null : cache
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.