如何从另一个文件访问静态函数内的变量?

// * SELECTING ALL POSTS.
    public static function selectAllPosts() {

        $query = Database::Connect()->prepare("SELECT * FROM posts");
        $query->execute();
        $recipe = $query->fetch(\PDO::FETCH_OBJ);

        // THIS IS THE TARGET.
        $recipeImage = $recipe->recipe_image;

        return true;
    }

    // THIS IS ANOTHER PHP FILE.
    $recipe_image = Posts::selectAllPosts()->$recipeImage ?? "default-recipe- 
    picture.png";

i expect $recipeImage to be accessed from another file.

It's not possible to access variables inside function.