Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PHPdoc for error handlers in ErrorMiddleware #2942

Merged

Conversation

TiMESPLiNTER
Copy link
Contributor

This PR adds type hints for string beside callable and ErrorHandlerInterface as the $this->callableResolver->resolve can resolve strings if they are a registered service id in the di container.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 220a812 on TiMESPLiNTER:fix/errorhandler-middleware-phpdoc into 5613cbb on slimphp:4.x.

@l0gicgate
Copy link
Member

I'm curious, is this necessary since a callable can in fact be a string?

@TiMESPLiNTER
Copy link
Contributor Author

TiMESPLiNTER commented Apr 17, 2020

I'm curious, is this necessary since a callable can in fact be a string?

If the string is a callable function, you're right yes. But a container id is not a callable but just a string which later on gets resolved to a callable.

Valid callable

function myHandler() { }
$errorMiddleware->setErrorHandler(HttpException::class, 'myHandler', true);

Invalid callable

$errorMiddleware->setErrorHandler(HttpException::class, 'my_handlers_container_id', true);

@l0gicgate
Copy link
Member

Fair enough. Merging.

@l0gicgate l0gicgate added this to the 4.6.0 milestone Apr 17, 2020
@l0gicgate l0gicgate merged commit 724ff3a into slimphp:4.x Apr 17, 2020
@l0gicgate l0gicgate mentioned this pull request Nov 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants