zendframework / zend-stratigility

Middleware for PHP built on top of PSR-7 and PSR-15
BSD 3-Clause "New" or "Revised" License
235 stars 57 forks source link

Naming conflict for "ErrorHandler" which actually is a middleware and not a RequestHandler #190

Open boesing opened 5 years ago

boesing commented 5 years ago

Hey there,

I am giving some trainings regarding zend-expressive, e.g. for some colleagues. One thing, which always came back to me as a question was:

Why is the ErrorHandler called ErrorHandler like all those request handlers and not ErrorMiddleware which actually suits better as its a middleware per definition.

Would like to see the next major version where the ErrorHandler is renamed to ErrorMiddleware.

Any thoughts on this?

weierophinney commented 5 years ago

We can do this by doing the following:

Please feel free to submit a PR against develop to accomplish the first step.

boesing commented 5 years ago

I like the idea of providing that new ErrorMiddleware. I am not sure if triggering a deprecation message is a good idea. As of zend-expressive, the ErrorHandler is being automatically set to the configuration. So after updating zend-stratigility, every zend-expressive project will receive deprecation messages.

I would rather implement just a @deprecated tag, so that the handler can be safely removed in v4 instead. A migration guide should probably mention that the registered delegators should attach the listeners to the new middleware, as just "aliasing" wont be enough. (Some more details can be found in this comment https://github.com/zendframework/zend-mvc/pull/294#issuecomment-421050228)

I will provide a PR shortly with the changes.

weierophinney commented 4 years ago

This repository has been closed and moved to laminas/laminas-stratigility; a new issue has been opened at https://github.com/laminas/laminas-stratigility/issues/3.