'color', Font_Variable_Prop_Type::get_key() => 'string', Size_Variable_Prop_Type::get_key() => 'size', Prop_Type_Adapter::GLOBAL_CUSTOM_SIZE_VARIABLE_KEY => 'size', ]; } return self::$mappings_cache; } public static function get_resolved_type( string $variable_type ): ?string { return self::get_type_mappings()[ $variable_type ] ?? null; } public static function convert_value_for_resolved_type( string $resolved_type, $value ) { if ( 'size' !== $resolved_type || ! is_string( $value ) ) { return $value; } return self::parse_size_string( $value ); } private static function parse_size_string( string $value ): array { $value = trim( strtolower( $value ) ); if ( 'auto' === $value ) { return [ 'size' => '', 'unit' => 'auto', ]; } if ( preg_match( '/^(-?\d*\.?\d+)([a-z%]+)$/i', $value, $matches ) ) { return [ 'size' => $matches[1] + 0, 'unit' => strtolower( $matches[2] ), ]; } return [ 'size' => $value, 'unit' => Size_Constants::DEFAULT_UNIT, ]; } }