config->getSystemValueInt('serverid', -1); if ($serverid < 1) { // Fallback: generates a server ID based on hostname /** @var int<0,max> */ $serverid = PHP_INT_SIZE === 4 ? hexdec(hash('xxh32', $this->getHostname())) // Makes sure it doesn't overflow 32 bits int : hexdec(substr(hash('xxh32', $this->getHostname()), -3)); } /** @var int<0,511> */ return $serverid & 0x1FF; } #[Override] public function getHostname(): string { $hostname = gethostname(); if ($hostname === false) { // Use a random hostname return bin2hex(random_bytes(8)); } return $hostname; } }