public static fromInteger ( integer $intValue ) : |
||
$intValue | integer | |
return |
public static function fromInteger($intValue)
{
self::paramsValidation($intValue, null);
if (!is_int($intValue)) {
throw new InvalidArgumentTypeException(['int'], is_object($intValue) ? get_class($intValue) : gettype($intValue), '$intValue must be of type int');
}
return new static((string) $intValue, 0);
}
public function testNegativeNumbers() { $this->assertFalse(Decimal::fromInteger(-1)->isZero()); $this->assertFalse(Decimal::fromFloat(-1.0)->isZero()); $this->assertFalse(Decimal::fromFloat(-0.1)->isZero()); $this->assertFalse(Decimal::fromString('-1')->isZero()); }