Change post type depending on shortcode

the callback function has 3 parameters and the 3rd is the tag name :

add_shortcode( 'all_faq', 'commonFunction' );
add_shortcode( 'wordpress_faq', 'commonFunction' );


function commonFunction($attr, $content, $tag) {

    $cores = [
        "all_faq" => "Faq",
        "wordpress_faq" => "wp-Faq",
    ];


    $args = array(
        'post_type' => $cores[$tag],
        'post_status' => 'publish',
        'posts_per_page' => '-1'
    );


    // ...

}