i think it would be best to take advantage of Hack's async in some places here.
These contracts can be async, and probably should :
interface CacheItemPoolInterface extends ResetInterface
{
public function getItem(string $key): Awaitable<CacheItemInterface>;
public function getItems(Container<string> $keys = vec[]): Awaitable<KeyedContainer<string, CacheItemInterface>>;
public function hasItem(string $key): Awaitable<bool>;
public function clear(): Awaitable<bool>;
public function deleteItem(string $key): Awaitable<bool>;
public function deleteItems(Container<string> $keys): Awaitable<bool>;
public function save(CacheItemInterface $item): Awaitable<bool>;
public function commit(): Awaitable<bool>;
}
interface CacheInterface
{
public function get(string $key, mixed $default = null): Awaitable<mixed>;
public function set(string $key, mixed $value, ?DateInterval $ttl = null): Awaitable<bool>;
public function delete(string $key): Awaitable<bool>;
public function clear(): Awaitable<bool>;
public function getMultiple(Container<string> $keys,mixed $default = null): Awaitable<KeyedContainer<string, mixed>>;
public function setMultiple(KeyedContainer<string, mixed> $values,?DateInterval $ttl = null): Awaitable<bool>;
public function deleteMultiple(Container<string> $keys): Awaitable<bool>;
public function has(string $key): Awaitable<bool>;
}
interface EventDispatcherInterface extends ResetInterface
{
...
/**
* Dispatch an event and call the listeners.
*/
public function dispatch(EventInterface $event): Awaitable<EventInterface>;
...
}
interface RequestHandlerInterface
{
/**
* Handle the request and return a response.
*/
public function handle(ServerRequestInterface $request): Awaitable<ResponseInterface>;
}
interface MiddlewareInterface
{
/**
* Process an incoming server request and return a response, optionally delegating
* response creation to a handler.
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): Awaitable<ResponseInterface>;
}