Open ciaranmcnulty opened 2 years ago
We have this in a lot of places (Generators, Matchers, Presenters) where we have an interface like:
interface Foo { public function supports(mixed ...$values): bool; public function do(mixed ...$values): Result; }
The problem is the concrete classes have to support(mixed) and callers have to 'remember' to call supports() first.
support(mixed)
supports()
Better might be a single method:
interface Foo { public function doIfPossible(mixed ...$values): false|Result }
We have this in a lot of places (Generators, Matchers, Presenters) where we have an interface like:
The problem is the concrete classes have to
support(mixed)
and callers have to 'remember' to callsupports()
first.Better might be a single method: