# Return type of onBootstrap

**URL:** <https://discourse.laminas.dev/t/return-type-of-onbootstrap/573>\
**Category:** Components & MVC\
**Created:** [May 3, 2018, 9:35am UTC](https://discourse.laminas.dev/t/return-type-of-onbootstrap/573 "2018-05-03T09:35:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gscscnd](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/gscscnd/32/647_2.png) [@gscscnd](https://discourse.laminas.dev/u/gscscnd)\
**Post date:** [May 3, 2018, 9:35am UTC](https://discourse.laminas.dev/t/return-type-of-onbootstrap/573/1 "2018-05-03T09:35:20Z")

</div>

Hello!

In [`BootstrapListenerInterface.php:23`](https://github.com/zendframework/zend-modulemanager/blob/release-2.8.2/src/Feature/BootstrapListenerInterface.php#L23) 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`](https://github.com/zendframework/zend-modulemanager/blob/release-2.8.2/src/Listener/OnBootstrapListener.php#L37)) — 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`](https://github.com/zendframework/zend-mvc/blob/release-3.1.1/src/Application.php#L151-L161).

Happy coding!

---

<div class="post-metadata">

**Author:** ![matthew](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/matthew/32/14_2.png) [@matthew](https://discourse.laminas.dev/u/matthew)\
**Post date:** [May 16, 2018, 4:23pm UTC](https://discourse.laminas.dev/t/return-type-of-onbootstrap/573/2 "2018-05-16T16:23:41Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![gscscnd](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/gscscnd/32/647_2.png) [@gscscnd](https://discourse.laminas.dev/u/gscscnd)\
**Post date:** [May 25, 2018, 11:01am UTC](https://discourse.laminas.dev/t/return-type-of-onbootstrap/573/3 "2018-05-25T11:01:23Z")

</div>

Thank you for detailed response 👍

> [@matthew](#):
>
> I’d totally appreciate a PR with that change.

> <https://github.com/zendframework/zend-modulemanager/pull/84>
>
> \`onBootstrap\` implementation is not expected to return anything.
> 
> See \[discour…se.zendframework.com/t/return-type-of-onbootstrap/573\](https://discourse.zendframework.com/t/return-type-of-onbootstrap/573?u=gscscnd).
