Added support for Foo::$onEvent methods

This only implements the suggestion in autocompletion.