src/Subjects/AbstractEavSubject.php
public function castValueByBackendType($backendType, $value)
    {

        // cast the value to a valid timestamp
        if ($backendType === BackendTypeKeys::BACKEND_TYPE_DATETIME) {
            return \DateTime::createFromFormat($this->getConfiguration()->getDateConverter()->getSourceDateFormat(), $value)->format('Y-m-d H:i:s');
        }

        // cast the value to a float value
        if ($backendType === BackendTypeKeys::BACKEND_TYPE_FLOAT) {
            return (float) $value;
        }

        // cast the value to an integer
        if ($backendType === BackendTypeKeys::BACKEND_TYPE_INT) {
            return (int) $value;
        }

        // we don't need to cast strings
        return $value;
    }
public function castValueByBackendType($backendType, $value)
    {

        // cast the value to a valid timestamp
        if ($backendType === BackendTypeKeys::BACKEND_TYPE_DATETIME) {
            return \DateTime::createFromFormat($this->getConfiguration()->getDateConverter()->getSourceDateFormat(), $value)->format('Y-m-d H:i:s');
        }

        // cast the value to a float value
        if ($backendType === BackendTypeKeys::BACKEND_TYPE_FLOAT) {
            return (float) $value;
        }

        // cast the value to an integer
        if ($backendType === BackendTypeKeys::BACKEND_TYPE_INT) {
            return (int) $value;
        }

        // we don't need to cast strings
        return $value;
    }
Cast's the passed value based on the backend type information.

@param string $backendType The backend type to cast to
@param mixed  $value       The value to be casted

@return mixed The casted value