X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/UninitializedVariableHandler.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/UninitializedVariableHandler.java new file mode 100644 index 0000000..f19dd61 --- /dev/null +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/UninitializedVariableHandler.java @@ -0,0 +1,54 @@ +package net.sourceforge.phpdt.internal.compiler.parser; + +import java.util.ArrayList; + +public class UninitializedVariableHandler { + + private class Function { + private int count; + private String name; + + public Function(String name, int count) { + this.name=name; + this.count=count; + } + } + + private String functionName=null; + private int argumentCount=0; + private ArrayList functions=new ArrayList(); + + public UninitializedVariableHandler() { + add("ereg",3); + add("eregi",3); + add("fsockopen",3); + add("preg_match",3); + add("preg_match_all",3); + add("preg_replace",5); + add("preg_replace_callback",5); + } + + private void add(String name, int countFrom) { + functions.add(new Function(name,countFrom)); + } + + protected boolean reportError() { + if (functionName!=null) { + for (int i=0; i=function.count) { + return false; + } + } + } + return true; + } + + public void setFunctionName(String functionName) { + this.functionName=functionName; + } + + public void incrementArgumentCount() { + argumentCount++; + } +}