0👍
get_array_of_post_objects function call is asynchronous call when executed it returns items which is an empty array and then when promise is resolved, no where to return it again, so you need to wait for the promise (resolved) to return the items.
Source:stackexchange.com