PHPSA\Variable::inc PHP Method

inc() public method

Increment value of the variable
public inc ( )
    public function inc()
    {
        $this->value++;
    }

Usage Example

コード例 #1
0
ファイル: VariableTest.php プロジェクト: sekjun9878/phpsa
 public function testIncValue()
 {
     $variable = new Variable('a', 1, CompiledExpression::INTEGER);
     static::assertSame(1, $variable->getValue());
     $variable->inc();
     static::assertSame(2, $variable->getValue());
     $variable->inc();
     static::assertSame(3, $variable->getValue());
     $variable->inc();
     $variable->inc();
     static::assertSame(5, $variable->getValue());
 }