Automattic\WooCommerce\EmailEditor\Validator

Validator::get_type_errorprivateWC 1.0

Returns a WP_Error for a type mismatch.

Метод класса: Validator{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// private - только в коде основоного (родительского) класса
$result = $this->get_type_error( $param, $type ): WP_Error;
$param(строка) (обязательный)
The parameter name.
$type(строка|string[]) (обязательный)
The expected type.

Код Validator::get_type_error() WC 10.0.2

private function get_type_error( string $param, $type ): WP_Error {
	$type = is_array( $type ) ? $type : array( $type );
	return new WP_Error(
		'rest_invalid_type',
		// translators: %1$s is the current parameter and %2$s a comma-separated list of the allowed types.
		sprintf( __( '%1$s is not of type %2$s.', 'woocommerce' ), $param, implode( ',', $type ) ),
		array( 'param' => $param )
	);
}