diff --git a/src/snowflake/src/Meta.php b/src/snowflake/src/Meta.php index 22ed43840..cc582fa6b 100644 --- a/src/snowflake/src/Meta.php +++ b/src/snowflake/src/Meta.php @@ -72,32 +72,28 @@ class Meta $this->sequence = $sequence; } - /** - * @param int $timestamp - * @return Meta - */ public function setTimestamp(int $timestamp): self { $this->timestamp = $timestamp; return $this; } - protected function maxMachineId() + protected function maxMachineId(): int { return -1 ^ (-1 << self::MACHINE_ID_BITS); } - protected function maxDataCenterId() + protected function maxDataCenterId(): int { return -1 ^ (-1 << self::DATA_CENTER_ID_BITS); } - protected function maxBusinessId() + protected function maxBusinessId(): int { return -1 ^ (-1 << self::BUSINESS_ID_BITS); } - protected function maxSequence() + protected function maxSequence(): int { return -1 ^ (-1 << self::SEQUENCE_BITS); } diff --git a/src/snowflake/src/Snowflake.php b/src/snowflake/src/Snowflake.php index 4f189de6c..b96121788 100644 --- a/src/snowflake/src/Snowflake.php +++ b/src/snowflake/src/Snowflake.php @@ -65,22 +65,22 @@ class Snowflake implements IdGeneratorInterface ))->setTimestamp($timestamp + $this->beginSecond); } - protected function getTimestampShift() + protected function getTimestampShift(): int { return Meta::SEQUENCE_BITS + Meta::MACHINE_ID_BITS + Meta::DATA_CENTER_ID_BITS + Meta::BUSINESS_ID_BITS; } - protected function getBusinessIdShift() + protected function getBusinessIdShift(): int { return Meta::SEQUENCE_BITS + Meta::MACHINE_ID_BITS + Meta::DATA_CENTER_ID_BITS; } - protected function getDataCenterShift() + protected function getDataCenterShift(): int { return Meta::SEQUENCE_BITS + Meta::MACHINE_ID_BITS; } - protected function getMachineIdShift() + protected function getMachineIdShift(): int { return Meta::SEQUENCE_BITS; }