/** * Returns a Integer object given a PHP native int as parameter. * * @param int $value */ public function __construct($value) { $value = filter_var($value, FILTER_VALIDATE_INT); if (false === $value) { throw new InvalidNativeArgumentException($value, array('int')); } parent::__construct($value); }
public function __construct($value) { parent::__construct($value); try { Assertion::integerish($value); $this->value = (int) $value; } catch (AssertionInvalidArgumentException $exception) { throw new InvalidArgumentException($value); } }