Automattic\WooCommerce\Api\Pagination

PaginationParams::validate_argspublic staticWC 1.0

Validate pagination limits on a raw args array without constructing a full PaginationParams instance.

Intended for call sites that take raw GraphQL args (like nested connection resolvers) and forward them to Connection::slice(). The constructor already runs the same checks for root queries that build a PaginationParams via #[Unroll], so this keeps both paths in sync.

Method of the class: PaginationParams{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = PaginationParams::validate_args( $args ): void;
$args(array) (required)
Raw args with optional first / last keys.

PaginationParams::validate_args() code WC 10.9.4

public static function validate_args( array $args ): void {
	self::validate_limit( 'first', $args['first'] ?? null );
	self::validate_limit( 'last', $args['last'] ?? null );
}