min = $min; return $this; } public function max(int $max): self { $this->max = $max; return $this; } protected function validateValue(ValidationResult $result): void { if ($this->isStrict() && !is_int($result->getValue())) { $result->setError("Value must be a int, got: " . gettype($result->getValue())); return; } if ($this->isStrict() === false && is_numeric($result->getValue())) { $value = intval($result->getValue()); $result->setValue($value); } $validator = new Integer(); if ($this->min) { $validator->min($this->min); } if ($this->max) { $validator->max($this->max); } if ($validator->validate($result->getValue()) === false) { $result->setError($validator->getError()); } } }