src/Config/Config.php
protected function castValues(array $values)
    {
        $keyInfos = $this->getKeyInfo();
        foreach ($keyInfos as $key => $keyInfo) {
            if (array_key_exists($key, $values)) {
                switch ($keyInfo['type']) {
                    case 'string':
                        if (!is_string($values[$key])) {
                            $values[$key] = (string) $values[$key];
                        }
                        break;
                    case 'int':
                        if (!is_int($values[$key])) {
                            $values[$key] = (int) $values[$key];
                        }
                        break;
                    case 'bool':
                        if (!is_bool($values[$key])) {
                            $values[$key] = (bool) $values[$key];
                        }
                        break;
                    case 'array':
                        if (!is_array($values[$key])) {
                            $values[$key] = array($values[$key]);
                        }
                        break;
                }
            }
        }
        return $values;
    }
protected function castValues(array $values)
    {
        $keyInfos = $this->getKeyInfo();
        foreach ($keyInfos as $key => $keyInfo) {
            if (array_key_exists($key, $values)) {
                switch ($keyInfo['type']) {
                    case 'string':
                        if (!is_string($values[$key])) {
                            $values[$key] = (string) $values[$key];
                        }
                        break;
                    case 'int':
                        if (!is_int($values[$key])) {
                            $values[$key] = (int) $values[$key];
                        }
                        break;
                    case 'bool':
                        if (!is_bool($values[$key])) {
                            $values[$key] = (bool) $values[$key];
                        }
                        break;
                    case 'array':
                        if (!is_array($values[$key])) {
                            $values[$key] = array($values[$key]);
                        }
                        break;
                }
            }
        }
        return $values;
    }
protected function castValues ( array $ values ) { $ keyInfos = $ this -> getKeyInfo ( ) ; foreach ( $ keyInfos as $ key => $ keyInfo ) { if ( array_key_exists ( $ key , $ values ) ) { switch ( $ keyInfo [ 'type' ] ) { case 'string' : if ( ! is_string ( $ values [ $ key ] ) ) { $ values [ $ key ] = ( string ) $ values [ $ key ] ; } break ; case 'int' : if ( ! is_int ( $ values [ $ key ] ) ) { $ values [ $ key ] = ( int ) $ values [ $ key ] ; } break ; case 'bool' : if ( ! is_bool ( $ values [ $ key ] ) ) { $ values [ $ key ] = ( bool ) $ values [ $ key ] ; } break ; case 'array' : if ( ! is_array ( $ values [ $ key ] ) ) { $ values [ $ key ] = array ( $ values [ $ key ] ) ; } break ; } } } return $ values ; }
Casts the values to their correct types.

Values that come from a submitted form are all strings. Values that come
from the config store might be null. However, internally we work with
booleans or integers. So after reading from the config store or form, we
cast the values to their expected types.

@param array $values

@return array
Array with casted values.
Casts the values to their correct types .