-
-
Notifications
You must be signed in to change notification settings - Fork 192
Open
Description
Initializers are quick to write, but very complex to maintain and refactor, since no explicit contract is provided.
Luckily, since PHP 7, it is possible to simply use anonymous classes.
What we can do is providing a decent interface for initializers now:
interface GhostObjectInitializer
{
public function __invoke(
LazyLoadingGhostObject $proxy,
?GhostObjectInitializer $initializer,
array $properties
) : bool;
}Consumers can then use an anonymous class to instantiate such an initializer inline, but would still retain the BC and refactoring advantages of the stronger type hinting.