modify() 공개 메소드

Changes variable type and value.
public modify ( integer $type, mixed $value )
$type integer
$value mixed
예제 #1
0
 /**
  * @param int $type
  * @param mixed $value
  */
 public function modify($type, $value)
 {
     $this->type = (int) $type;
     $this->value = $value;
     if ($this->referencedTo) {
         $this->referencedTo->modify($type, $value);
     }
 }
예제 #2
0
 public function testReferenceToChange()
 {
     /**
      * $a = 1;
      * $b = &$a;
      */
     $parentVariable = new Variable('a', 1, CompiledExpression::INTEGER);
     $variable = new Variable('b', $parentVariable->getValue(), $parentVariable->getType());
     static::assertFalse($variable->isReferenced());
     $variable->setReferencedTo($parentVariable);
     static::assertTrue($variable->isReferenced());
     static::assertSame($parentVariable, $variable->getReferencedTo());
     /**
      * $b = 55.00
      */
     $variable->modify(CompiledExpression::DOUBLE, 55.0);
     static::assertSame($variable->getValue(), $parentVariable->getValue());
     static::assertSame($variable->getType(), $parentVariable->getType());
 }