Throw an exception if <i>$value</i> is not an int or null.

@param mixed $value
@throws MWrongTypeException
7513
public static function mustBeNullableInt($value)
    {
        if (is_int($value) === false && $value != null) {
            throw new MWrongTypeException('\$value', 'int|null', gettype($value));
        }
    }
1257300
private function checkValueIsValidOrThrowException($value)
    {
        if (!\is_array($value) || 1 !== \count($value)) {
            throw new FilterErrorException(
                'Condition parsing failed for "'
                . var_export($value, true)
                . '", it should be something like: "isEqualTo" : "a value"'
            );
        }
    }
1166116
public function setValue($value)
    {
        $value = $this->preformatValue($value);
        $manager = $this->getManager();
        $manager->clean();
        foreach ($value as $linkModel) {
            if (
                false === ($linkModel instanceof ModelInterface) &&
                !is_a($linkModel, $this->modelClass)) {
                $linkModel = call_user_func([$this->modelClass, 'objects'])->get(['pk' => $linkModel]);
            }

            if ($linkModel instanceof ModelInterface) {
                $manager->link($linkModel);
            } else {
                throw new Exception('ManyToMany field can set only arrays of Models or existing primary keys');
            }
        }
    }
793889
public static function isInt($value) {
        if(is_object($value)) {
            $value = Assert::isString($value);
        }
        if(is_int($value)) {
            return $value;
        } elseif(is_scalar($value) && preg_match('@^-?[0-9]+$@', $value)) {
            return (int)$value;
        } else {
            throw new \InvalidArgumentException('Must be Int: ' . print_r($value, true));
        }
    }
238018
public function setValue($value)
    {
        if (is_int($value) || is_float($value)) {
            $this->value = $value;
        } else {
            $msg = "The value of a Weight must be a valid integer or float value, '" . gettype($value) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
757941
public function setRawValue( $value )
	{
		if ( is_null( $value ) )
			$this->_value = CoreFuncs::$False;
		else
			$this->_value = $value;

		$this->_xmlType = null;
	}
440339
public function setType($value)
    {
        $this->_validateNotNull('Type', $value);
        $this->_validateString('Type', $value);

        if ($this->data['type'] === $value) {
            return;
        }

        $this->data['type'] = $value;

        $this->_setModified('type');
    }
1069581
static public function notNull($value, $message = null, $propertyPath = null)
        {
            if ($value === null) {
                $message = $message ?: sprintf(
                    'Value "%s" is null, but non null value was expected.',
                    static::stringify($value)
                );

                throw static::createException($value, $message, static::VALUE_NULL, $propertyPath);
            }
        }
354817
public function toObject($value)
    {
        if (!is_array($value)) {
            throw new TypeCastException('Is not array');
        }

        foreach ($this->rules as $class => $rule) {
            if ($this->isMatch($rule, $value)) {
                return $this->createInstance($class, $value);
            }
        }

        throw new TypeCastException('Rule not found');
    }
674760
public static function mustBeNullableBoolean($value)
    {
        if (is_bool($value) === false && $value != null) {
            throw new MWrongTypeException('\$value', 'boolean|null', gettype($value));
        }
    }
114630
public function execute($value)
    {
        if (!is_array($value) || count($value) != 2) {
            throw new \Exception('Value for number range comparison should have to values');
        }

        $queryBuilder = $this->getQueryBuilder();

        if (!empty($value[0])) {
            $queryBuilder->andHaving(
                $queryBuilder->expr()->gte(
                    $this->getIndex(),
                    ":{$this->getIndexClean()}_1"
                )
            )
                ->setParameter(
                    ":{$this->getIndexClean()}_1",
                    (float) $value[0]
                );
        }

        if (!empty($value[1])) {
            $queryBuilder->andHaving(
                $queryBuilder->expr()->lte(
                    $this->getIndex(),
                    ":{$this->getIndexClean()}_2"
                )
            )
                ->setParameter(
                    ":{$this->getIndexClean()}_2",
                    (float) $value[1]
                );
        }
    }
1108836
public function transform($value)
    {
        if (null === $value) {
            return null;
        }

        if (!is_string($value)) {
            throw new UnexpectedTypeException($value, 'string');
        }

        return true;
    }
1276940
public function addValue($value)
    {
        if ($this->datatype == 'string') {
            if (is_string($value) == false) {
                throw new InvalidArgumentException('The value(' . $value . ') is not string but the restriction demands it');
            }
        } elseif ($this->datatype == 'integer') {
            // The value comes as string from the wsdl
            if (is_string($value)) {
                $value = intval($value);
            }

            if (is_int($value) == false) {
                throw new InvalidArgumentException('The value(' . $value . ') is not int but the restriction demands it');
            }
        } else {
            if ($value == null) {
                throw new InvalidArgumentException('Value(' . $value . ') is null');
            }
        }

        $this->values[] = $value;
    }
998892
static public function isInt($value) {
    return ((string) (int) $value === (string) $value or $value === false or empty($value));
  }
170429
protected function setValue($value)
    {
        if (!is_string($value)) {
            throw InvalidTypeException::fromMessageAndPrototype("Value must be a string", static::prototype());
        }

        if(!mb_check_encoding($value, 'UTF-8')) {
            throw InvalidTypeException::fromMessageAndPrototype("Value must be a UTF-8 encoded", static::prototype());
        }

        $this->value = $value;
    }
1182870
public function checkType($value)
    {
        if (isset($this->name) && null !== $this->name) {
            $fn = 'is_'.$this->name;

            return $fn($value);
        }

        throw new \Exception('Invalid name or name not defined for primitive type.');
    }
104477
public function setRrn($value)
    {
        if ($value === null || $value === '') {
            $this->_rrn = $value;
        } elseif (TypeCast::canCastToEnumString($value)) {
            $this->_rrn = (string)$value;
        } else {
            throw new InvalidPropertyValueTypeException('Invalid rrn value type', 0,
                'authorization_details.rrn', $value);
        }
    }