Automattic\WooCommerce\EmailEditor\Validator
Validator::get_type_error
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() Validator::get type error WC 11.0.1
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 )
);
}