PHPSA\Variable::isReferenced PHP Method

isReferenced() public method

public isReferenced ( ) : boolean
return boolean
    public function isReferenced()
    {
        return $this->referenced;
    }

Usage Example

Example #1
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());
 }