-
Notifications
You must be signed in to change notification settings - Fork 625
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
Make $emailAddress on TypeException to be evaluated #841
Conversation
Change the exception message from single quotes to double quotes so the user will know which email address failed.
There is another issue on the code flow, that I didn't have the time to check. I have this code:
By mistake instead, to call The Bcc class I called the Cc class, which caused the $emailAddress to be SendGridMailCc Object and not a string like the documentation says. |
Hello @yehudah, Thank you for the PR! With regards to your second issue with respect to code flow, I'm not quite sure I follow. What is the expected result? With Best Regards, Elmer |
@@ -74,7 +74,7 @@ public function setEmailAddress($emailAddress) | |||
filter_var($emailAddress, FILTER_VALIDATE_EMAIL)) | |||
) { | |||
throw new TypeException( | |||
'$emailAddress must be valid and of type string.' | |||
"{$emailAddress} must be valid and of type string." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep attention if a $emailAddress
is not a string and it's can't be converto to string this generate a php error!
if you need to cast this value to string, probably the best choise is do something like: https://github.com/webmozart/assert/blob/master/src/Assert.php#L1145
Change the exception message from single quotes to double quotes so the user will know which email address failed.