Skip to content
New issue

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

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

Already on GitHub? # 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
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant