<?php

declare(strict_types=1);

namespace Apexl\Io\Interfaces;

/**
 * A hook: something that runs when a named point in the framework is reached.
 *
 * The keys are declared statically because boot has to ask every hook in every module
 * which points it wants, long before it knows whether any of them will be reached. Asked
 * of an instance, that question costs a constructed object — and, through the container,
 * everything that object depends on — for every hook in the application, most of which
 * will not fire on this request. Asked of the class, it costs nothing but autoloading.
 *
 * The instance is still built, lazily, when the hook actually fires: HookManager registers
 * the class-string and resolves it from the container at that point. Constructor injection
 * works exactly as before, and __invoke() is the hook body.
 */
interface HookInterface
{
    /**
     * The hook keys this class subscribes to.
     *
     * @return string[]
     */
    public static function hooks(): array;
}
