/** * Set maximum. */ public function setMaximum($maximum) { $this->maximum = \CastToType::cast($maximum, 'integer', false, true); }
/** * @param mixed $value * @param string $type * * @return mixed */ private function cast($value, $type) { $castValue = $value; if ($type == 'number') { $type = 'num'; } if ($type != 'date') { $castValue = \CastToType::cast($value, $type, false, true); } else { //Specific case for date $castValue = new \DateTime($value); } //The cast not working, parameters is probably not this $type if (is_null($castValue)) { return $value; } return $castValue; }