value < 0) { throw new \InvalidArgumentException('Field value must be non-negative.'); } if ($this->value > $this->maxValue()) { throw new \InvalidArgumentException(sprintf( 'Field value %d exceeds maximum %d for %d bits.', $this->value, $this->maxValue(), $this->bits )); } } public function value(): int { return $this->value; } }