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

declare __toString as @throws void #96

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

staabm
Copy link

@staabm staabm commented Nov 26, 2021

with this change static analysis tools are able to detect implementations which throw.

see https://phpstan.org/r/90fcf22e-b99b-4455-bf32-a9a7078fbb39

technically throwing from __toString() is allowed since php 7.4+, but since the contract explicitly mentions this should not be done, I figured declaring the respective phpdoc would be a improvement.

with this change static analysis tools are able to detect implementations which throw.

see https://phpstan.org/r/90fcf22e-b99b-4455-bf32-a9a7078fbb39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant