PHPSA\Variable::modifyType PHP Method

modifyType() public method

Changes variable type.
public modifyType ( integer $type )
$type integer
    public function modifyType($type)
    {
        $this->type = (int) $type;
    }

Usage Example

Example #1
0
 public function testModifyType()
 {
     $variable = new Variable('a', 1, CompiledExpression::INTEGER);
     static::assertSame(CompiledExpression::INTEGER, $variable->getType());
     $newType = CompiledExpression::BOOLEAN;
     $variable->modifyType($newType);
     static::assertSame($newType, $variable->getType());
 }