Skip to content

Commit e3c1837

Browse files
committed
fixup! fixup! feat(snowflake): Use string as type for snowflake ids
1 parent afb4fbd commit e3c1837

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/private/DB/Snowflake/SnowflakeGenerator.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ public function nextId(): string {
9797
throw new \RuntimeException('gmp is a required extension on 32bits system.');
9898
}
9999

100+
echo "Using 32 bits version" . PHP_EOL;
101+
100102
$currentTimeGmp = gmp_init($currentTime);
101103
$timestampGmp = gmp_init($timestamp);
102104

@@ -112,8 +114,12 @@ public function nextId(): string {
112114

113115
$id = gmp_add(gmp_add(gmp_add(gmp_add($tsPart, $dcPart), $wkPart), $cliPart), $seqPart);
114116

115-
return gmp_strval($id);
117+
$result = gmp_strval($id);
118+
echo "generated id:" . $id . PHP_EOL;
119+
return $result;
116120
} else {
121+
echo "Using 64 bits version" . PHP_EOL;
122+
117123
// Dependency less version for 64-bits machine using bits-shifts
118124
return (string)((((int)$currentTime - (int)$timestamp) << $timestampLeftMoveLength)
119125
| ($this->datacenter << $datacenterLeftMoveLength)

0 commit comments

Comments
 (0)