Creating Admin Submenu Page via Class Method

the action admin_menu is called with one empty argument, then anonymous function can only be with 0 or 1 useless argument.
and then if you want to pass variables to this function, you can try that :

public function add_submenu_page( $title, $capability = 'administrator' ) {

    $post_type = self::uglify( $this->post_type_name );


    $GLOBALS["MyPlugin_menu"] = [
        "post_type" => $post_type,
        "menu_title" => self::beautify( $title ),
        "menu_capability" => $capability,
        "parent_slug" => 'edit.php?post_type=" . $post_type,
        "menu_slug" => self::uglify( $post_type ) . "_' . 'menu_' . self::uglify( $title ),
    ];


    add_action("admin_menu", function() {

        add_submenu_page(
              $GLOBALS["MyPlugin_menu"]["parent_slug"]
            , $GLOBALS["MyPlugin_menu"]["menu_title"]
            , $GLOBALS["MyPlugin_menu"]["menu_title"]
            , $GLOBALS["MyPlugin_menu"]["menu_capability"]
            , $GLOBALS["MyPlugin_menu"]["menu_slug"]
            , function() {
                echo 'The Page Actually Worked!';
            }
        );


    });


}

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)