php/class-wp-cli.php
public static function do_hook( $when ) {

		$args = func_num_args() > 1
			? array_slice( func_get_args(), 1 )
			: array();

		self::$hooks_passed[ $when ] = $args;

		if ( ! isset( self::$hooks[ $when ] ) ) {
			return;
		}

		self::debug(
			sprintf(
				'Processing hook "%s" with %d callbacks',
				$when,
				count( self::$hooks[ $when ] )
			),
			'hooks'
		);

		foreach ( self::$hooks[ $when ] as $callback ) {
			self::debug(
				sprintf(
					'On hook "%s": %s',
					$when,
					Utils\describe_callable( $callback )
				),
				'hooks'
			);
			call_user_func_array( $callback, $args );
		}
	}
public static function do_hook( $when ) {

		$args = func_num_args() > 1
			? array_slice( func_get_args(), 1 )
			: array();

		self::$hooks_passed[ $when ] = $args;

		if ( ! isset( self::$hooks[ $when ] ) ) {
			return;
		}

		self::debug(
			sprintf(
				'Processing hook "%s" with %d callbacks',
				$when,
				count( self::$hooks[ $when ] )
			),
			'hooks'
		);

		foreach ( self::$hooks[ $when ] as $callback ) {
			self::debug(
				sprintf(
					'On hook "%s": %s',
					$when,
					Utils\describe_callable( $callback )
				),
				'hooks'
			);
			call_user_func_array( $callback, $args );
		}
	}
public static function do_hook ( $ when ) { $ args = func_num_args ( ) > 1 ? array_slice ( func_get_args ( ) , 1 ) : array ( ) ; self :: $ hooks_passed [ $ when ] = $ args ; if ( ! isset ( self :: $ hooks [ $ when ] ) ) { return ; } self :: debug ( sprintf ( 'Processing hook "%s" with %d callbacks' , $ when , count ( self :: $ hooks [ $ when ] ) ) , 'hooks' ) ; foreach ( self :: $ hooks [ $ when ] as $ callback ) { self :: debug ( sprintf ( 'On hook "%s": %s' , $ when , Utils \ describe_callable ( $ callback ) ) , 'hooks' ) ; call_user_func_array ( $ callback , $ args ) ; } }
Execute callbacks registered to a given hook.

See `WP_CLI::add_hook()` for details on WP-CLI's internal hook system.
Commands can provide and call their own hooks.

@access public
@category Registration

@param string $when Identifier for the hook.
@param mixed ... Optional. Arguments that will be passed onto the
callback provided by `WP_CLI::add_hook()`.
@return null
Execute callbacks registered to a given hook .