Changes:
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / parser / PHPVarDeclaration.java
index ac22f1b..094f97d 100644 (file)
@@ -4,14 +4,16 @@ import net.sourceforge.phpdt.internal.ui.PHPUiImages;
 
 import org.eclipse.jface.resource.ImageDescriptor;
 
+import test.PHPVar;
+
 /**
  * A php variable declaration strongly inspired by the PHPFunctionDeclaration of Khartlage (:.
  * @author khartlage, Matthieu Casanova
  */
 public class PHPVarDeclaration extends PHPSegment {
 
-  /** The value of the variable. */
-  private String value;
+  /** A PHPVar. */
+  private final PHPVar variable;
     /**
      * Create a php variable declaration.
      * @param parent the parent object (it should be a php class)
@@ -21,7 +23,7 @@ public class PHPVarDeclaration extends PHPSegment {
      */
     public PHPVarDeclaration(Object parent, String name, int index, String value) {
       super(parent, name, index);
-      this.value = value;
+      variable = new PHPVar(name,value);
     }
 
   /**
@@ -42,11 +44,15 @@ public class PHPVarDeclaration extends PHPSegment {
         return PHPUiImages.DESC_VAR;
     }
 
+  /**
+   * Get the PHPVar.
+   * @return a phpvar object
+   */
+  public PHPVar getVariable() {
+    return variable;
+  }
+
   public String toString() {
-    if (value == null || value.equals("")) {
-      return super.toString();
-    } else {
-      return name + " = " + value;
-    }
+    return variable.toString();
   }
 }