You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
but it is not enforced when calling the handler callable. I suggest to add correct return type declaration to the ErrorMiddleware::handleException function but wanted to get you opinion about it. Should this be enforced and if how would you have this enforced?
The text was updated successfully, but these errors were encountered:
lordrhodos
changed the title
ErrorMiddleware::handleException function passes wrong number of parameters to handler: response is missing
ErrorMiddleware::handleException function passes wrong number of parameters to handler
Jan 11, 2019
The Response object needs to be created in the handler, hence why it isn't being passed. Also with the migration to PSR-15 Middleware the Response object won't be available at all via ErrorMiddleware anymore after #2555 is merged.
The new
ErrorMiddleware
currently passes 5 parameters to the handler:Slim/Slim/Middleware/ErrorMiddleware.php
Lines 116 to 122 in bcf7df5
The PR #2398 documents four parameters, one of them being a
$response
object:This PR fixes several issues:
$response
object as second parameter to the handler with the status code set to the exceptions codea working example looks like:
Discussion
The phpdocs on some methods mention the return type
Slim/Slim/Middleware/ErrorMiddleware.php
Lines 155 to 156 in bcf7df5
but it is not enforced when calling the handler callable. I suggest to add correct return type declaration to the
ErrorMiddleware::handleException
function but wanted to get you opinion about it. Should this be enforced and if how would you have this enforced?The text was updated successfully, but these errors were encountered: