Automattic\WooCommerce\EmailEditor\Validator
Validator::get_type_error
Returns a WP_Error for a type mismatch.
Method of the class: Validator{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->get_type_error( $param, $type ): WP_Error;
- $param(string) (required)
- The parameter name.
- $type(string|string[]) (required)
- The expected type.
Validator::get_type_error() Validator::get type error code WC 10.5.0
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 )
);
}