/** * Constructor * * Add a default initializer to ensure the plugin is valid after instance * creation. * * @param null|ConfigInterface $configuration */ public function __construct(ConfigInterface $configuration = null) { parent::__construct($configuration); $self = $this; $this->addInitializer(function ($instance) use($self) { if ($instance instanceof ServiceLocatorAwareInterface) { $instance->setServiceLocator($self); } }); }