Skip to content

Using templates/generics #4

@bronek89

Description

@bronek89

Hi,

It would be nice if Input and Getter will be generic someday :)

use DataMap\Input\Input;

/** 
* @template TInput
* @template TOutput
*/
interface Getter
{
    /**
     * @param Input<TInput> $input
     * @return TOutput
     */
    public function __invoke(Input $input);
}
/** 
* @template TInput
*/
interface Input
{
    /**
     * @param TInput $default
     * @return TInput
     */
    public function get(string $key, $default = null);
    public function has(string $key): bool;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions