When using interface with self as return i.e. Functor new class require reimplementing.
class A implements Functor {
public function map(callable $function): self {
}
}
this code results in error
Declaration of A::map(callable $function): A must be compatible with FunctionalPHP\FantasyLand\Functor::map(callable $function): FunctionalPHP\FantasyLand\Functor in (..)
To fix it, interface should have explicit return type
class A implements Functor {
public function map(callable $function): Functor {
}
}
When using interface with
self
as return i.e.Functor
new class require reimplementing.this code results in error
To fix it, interface should have explicit return type