Here is some code from a WP plugin. I'm fairly new to OOP and I'm not actually familiar with the \ in the function parameters which looks like it's instantiating a class. Anybody care to clarify please?
public function customize_membership_plan_row_actions( $actions, \WP_Post $post ) {
global $typenow;
Here's the full function for reference.
/**
* Customizes membership plan row actions.
*
* @since 1.0.0
*
* @param array $actions array of post actions
* @param \WP_Post $post post object
* @return array
*/
public function customize_membership_plan_row_actions( $actions, \WP_Post $post ) {
global $typenow;
if ( 'wc_membership_plan' !== $typenow ) {
return $actions;
}
// add view as member action
$actions['view_as_member'] = '<a href="' . wp_nonce_url( admin_url( 'edit.php?post_type=wc_membership_plan&action=view_as_member&post=' . $post->ID ), 'wc-memberships-view-as-member-of_' . $post->ID ) . '" title="' . __( 'View site as a member of this plan', 'woocommerce-memberships' ) . '" rel="permalink">' .
__( 'View site as member', 'woocommerce-memberships' ) .
'</a>';
return $actions;
}