src/Serializer/AbstractItemNormalizer.php
protected function validateType(string $attribute, Type $type, $value, string $format = null)
    {
        $builtinType = $type->getBuiltinType();
        if (Type::BUILTIN_TYPE_FLOAT === $builtinType && null !== $format && false !== strpos($format, 'json')) {
            $isValid = \is_float($value) || \is_int($value);
        } else {
            $isValid = \call_user_func('is_'.$builtinType, $value);
        }

        if (!$isValid) {
            throw new InvalidArgumentException(sprintf(
                'The type of the "%s" attribute must be "%s", "%s" given.', $attribute, $builtinType, \gettype($value)
            ));
        }
    }
protected function validateType(string $attribute, Type $type, $value, string $format = null)
    {
        $builtinType = $type->getBuiltinType();
        if (Type::BUILTIN_TYPE_FLOAT === $builtinType && null !== $format && false !== strpos($format, 'json')) {
            $isValid = \is_float($value) || \is_int($value);
        } else {
            $isValid = \call_user_func('is_'.$builtinType, $value);
        }

        if (!$isValid) {
            throw new InvalidArgumentException(sprintf(
                'The type of the "%s" attribute must be "%s", "%s" given.', $attribute, $builtinType, \gettype($value)
            ));
        }
    }
protected function validateType ( string $ attribute , Type $ type , $ value , string $ format = null ) { $ builtinType = $ type -> getBuiltinType ( ) ; if ( Type :: BUILTIN_TYPE_FLOAT === $ builtinType && null !== $ format && false !== strpos ( $ format , 'json' ) ) { $ isValid = \ is_float ( $ value ) || \ is_int ( $ value ) ; } else { $ isValid = \ call_user_func ( 'is_' . $ builtinType , $ value ) ; } if ( ! $ isValid ) { throw new InvalidArgumentException ( sprintf ( 'The type of the "%s" attribute must be "%s", "%s" given.' , $ attribute , $ builtinType , \ gettype ( $ value ) ) ) ; } }
Validates the type of the value. Allows using integers as floats for JSON formats.

@throws InvalidArgumentException
Validates the type of the value . Allows using integers as floats for JSON formats .