public boolean visit(PHPFieldDeclaration declaration) throws Exception { // This is variable declaration: ISourceElementRequestor.FieldInfo info = new ISourceElementRequestor.FieldInfo(); info.modifiers = declaration.getModifiers(); info.name = declaration.getName(); SimpleReference var = declaration.getRef(); info.nameSourceEnd = var.sourceEnd() - 1; info.nameSourceStart = var.sourceStart(); info.declarationStart = declaration.getDeclarationStart(); info.modifiers = markAsDeprecated(info.modifiers, declaration); PHPDocBlock doc = declaration.getPHPDoc(); if (doc != null) { for (PHPDocTag tag : doc.getTags(PHPDocTag.VAR)) { // do it like for // PHPDocumentationContentAccess#handleBlockTags(List tags): // variable name can be optional, but if present keep only // the good ones if (tag.getVariableReference() != null && !tag.getVariableReference().getName().equals(declaration.getName())) { continue; } if (tag.getTypeReferences().size() > 0) { info.type = PHPModelUtils.appendTypeReferenceNames(tag.getTypeReferences()); break; } } } fInfoStack.push(info); fRequestor.enterField(info); return true; }
public boolean visit(Statement e) throws Exception { if (typeDeclaration.sourceStart() < e.sourceStart() && typeDeclaration.sourceEnd() > e.sourceEnd()) { if (e instanceof PHPFieldDeclaration) { PHPFieldDeclaration phpFieldDecl = (PHPFieldDeclaration) e; if (phpFieldDecl.getDeclarationStart() == offset && phpFieldDecl.sourceEnd() - phpFieldDecl.getDeclarationStart() == length) { result = ((PHPFieldDeclaration) e).getVariableValue(); if (result instanceof Scalar) { Scalar scalar = (Scalar) result; if (scalar.getScalarType() == Scalar.TYPE_STRING && scalar.getValue().toLowerCase().equals(NULL)) { result = null; } } context = contextStack.peek(); } } } return visitGeneral(e); }