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

replace magic __toString method with toString #93

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

Conversation

p4veI
Copy link

@p4veI p4veI commented Apr 13, 2021

What if we've replaced the magic __toString method with a regular toString method, would make the usage nicer.

@@ -308,7 +308,7 @@ public function withFragment($fragment);
* - If an authority is present, it MUST be prefixed by "//".
* - The path can be concatenated without delimiters. But there are two
* cases where the path has to be adjusted to make the URI reference
* valid as PHP does not allow to throw an exception in __toString():
* valid:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering if throwing exceptions for these cases would be an option now..

@GrahamCampbell
Copy link
Contributor

👎 Newer PHP does allow this method to throw an exception.

@ADmad
Copy link

ADmad commented Sep 8, 2021

What if we've replaced the magic __toString method with a regular toString method, would make the usage nicer.

👎
You lose the ability to cast the object to a string by doing so.

@p4veI
Copy link
Author

p4veI commented Sep 9, 2021

What about adding the method then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants