Skip to content

Commit

Permalink
Added BigInt
Browse files Browse the repository at this point in the history
  • Loading branch information
fadrian06 committed Jan 12, 2024
1 parent d0c20f7 commit e9ac995
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/Globals/BigInt.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

final class BigInt {
/** @var int */
private $value;

/** @param string|int|BigInt|bool $value */
function __construct($value) {
if ($value instanceof BigInt) {
$value = $value->valueOf();
}

$this->value = (int) $value;
}

/** Returns the primitive value of the specified object. */
function valueOf(): int {
return $this->value;
}
}

/** @param string|int|BigInt|bool $value */
function BigInt($value): BigInt {
return new BigInt($value);
}

0 comments on commit e9ac995

Please sign in to comment.