public boolean visit(TypeDeclaration type) throws Exception {
    if (type instanceof NamespaceDeclaration) {
      NamespaceDeclaration namespaceDecl = (NamespaceDeclaration) type;
      fLastNamespace = namespaceDecl;
      fLastUseParts.clear();
      if (namespaceDecl.isGlobal()) {
        return true;
      }
    }
    type.setModifiers(markAsDeprecated(type.getModifiers(), type));

    // In case we are entering a nested element
    if (!declarations.empty() && declarations.peek() instanceof MethodDeclaration) {
      if (fLastNamespace == null) {
        deferredDeclarations.add(type);
      } else {
        deferredNamespacedDeclarations.add(type);
      }
      return false;
    }

    declarations.push(type);

    for (PHPSourceElementRequestorExtension visitor : extensions) {
      visitor.visit(type);
    }
    return super.visit(type);
  }