Return type of onBootstrap

Hello!

In BootstrapListenerInterface.php:23 it’s stated that implementations of onBootstrap() are expected to return array, but I’m not sure if it’s correct. Such implementation is just going to be attached to ModuleManage::EVENT_BOOTSTRAP (OnBootstrapListener.php:37) — is its return value ever going to be read? If not, the type hint should be probably changed to void.

Bonus question: is it possible for onBootstrap()’s only argument (EventInterface $e) to not be instance of MvcEvent? See Application.php:151.

Happy coding!

Generally speaking, bootstrap listeners should not return anything; we do not inspect the return value, nor short-circuit based on it. The typehint should be void; I’d totally appreciate a PR with that change.

As for the typehint of the event argument: this is because, theoretically, you could call the listener in another event context, and receive a different event type (e.g., custom application).

The interface is mostly moot. We check for either an implementation of that interface, or that the class duck-types it (and we only check that the method exists; we do no verification of the signature).

Thank you for detailed response :+1: