Hi! > a typical use case would be > > class EventHandler { > public function handle(ProductCreated $event) { > ... > } > public function handle(ProductNameChanged $event) { > ... > } > } > > vs what's currently being done: > > class EventHandler { > public function handleProductCreated(ProductCreated $event) { > ... > } > public function handleProductNameChanged(ProductNameChanged $event) { > ... > } > }
And that's exactly why we shouldn't do it. Having a class with 20 methods called "handle" is a nightmare. Especially when you try to figure out which of those handles this line of code is calling. In Java, you'd at least have total typing to help you (and even then I'd recommend against this (ab)use of overloading), in PHP, you may not have that help. Google C++ style guide says: Use overloaded functions (including constructors) only if a reader looking at a call site can get a good idea of what is happening without having to first figure out exactly which overload is being called. -- Stas Malyshev smalys...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php