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

Make $emailAddress on TypeException to be evaluated #841

Merged
merged 1 commit into from
May 20, 2019

Conversation

yehudah
Copy link
Contributor

@yehudah yehudah commented May 16, 2019

  • [X ] I acknowledge that all my contributions will be made under the project's license
  • I have made a material change to the repo (functionality, testing, spelling, grammar)
  • [X ] I have read the [Contribution Guide] and my PR follows them.
  • I updated my branch with the development branch.
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation about the functionality in the appropriate .md file
  • I have added inline documentation to the code I modified

Change the exception message from single quotes to double quotes so the user will know which email address failed.

Change the exception message from single quotes to double quotes so the user will know which email address failed.
@thinkingserious thinkingserious added the status: code review request requesting a community code review or review from Twilio label May 16, 2019
@yehudah
Copy link
Contributor Author

yehudah commented May 20, 2019

There is another issue on the code flow, that I didn't have the time to check.

I have this code:

$bccEmails = array();
foreach ( ( array ) $message->getBccRecipients() as $recipient ) {
                $recipient->log($this->logger, 'Bcc');
                $bccEmails[] = new \SendGrid\Mail\Bcc( $recipient->getEmail(), $recipient->getName() );
}
$email->addBccs($bccEmails);

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.

@thinkingserious thinkingserious added difficulty: easy fix is easy in difficulty type: community enhancement feature request not on Twilio's roadmap status: ready for deploy code ready to be released in next deploy and removed status: code review request requesting a community code review or review from Twilio labels May 20, 2019
@thinkingserious thinkingserious merged commit 1daaced into sendgrid:master May 20, 2019
@thinkingserious
Copy link
Contributor

Hello @yehudah,

Thanks again for the PR!

We want to show our appreciation by sending you some swag. Could you please fill out this form so we can send it to you? Thanks!

Team SendGrid DX

@thinkingserious
Copy link
Contributor

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."
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: easy fix is easy in difficulty status: ready for deploy code ready to be released in next deploy type: community enhancement feature request not on Twilio's roadmap
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants