-
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
feat: enhanced type exception handling #762
Conversation
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.
The const values I think we don't need to add the \
.
They should be removed.
Made some optional improvement of TravisCI deployment:
|
@misantron, I don't think the Please split two PRs. Thanks. |
@peter279k These builds throw an error because of Prism server: |
All right. And you can create new PR to fix that. It's out of range for this PR. |
Ok. Should I rollback the changes? |
#766 @peter279k PR for TravisCI is ready |
Hello @misantron, |
…patch # Conflicts: # lib/mail/Asm.php # lib/mail/EmailAddress.php # lib/mail/Mail.php # test/unit/EmailAddressHelperTest.php
# Conflicts: # composer.json # lib/mail/Asm.php # lib/mail/Attachment.php # lib/mail/BatchId.php # lib/mail/BccSettings.php # lib/mail/BypassListManagement.php # lib/mail/Category.php # lib/mail/ClickTracking.php # lib/mail/CustomArg.php # lib/mail/EmailAddress.php # lib/mail/Footer.php # lib/mail/Ganalytics.php # lib/mail/GroupId.php # lib/mail/GroupsToDisplay.php # lib/mail/Header.php # lib/mail/IpPoolName.php # lib/mail/Mail.php # lib/mail/MailSettings.php # lib/mail/OpenTracking.php # lib/mail/Personalization.php # lib/mail/SandBoxMode.php # lib/mail/Section.php # lib/mail/SendAt.php # lib/mail/SpamCheck.php # lib/mail/SubscriptionTracking.php # lib/mail/Substitution.php # lib/mail/TemplateId.php # test/BaseTestClass.php # test/unit/EmailAddressTest.php # test/unit/MailGetContentsTest.php
…to issue754-patch
This is not a official review, just some thoughts about contribution yet: In file The The try {
Assert::email($emailAddress, 'emailAddress');
return true;
} catch (TypeException $exception) {
return false;
} But as seen in all current usages (for now, only The if ($email instanceof From) {
$this->from = $email;
} else {
Assert::email($email, 'email', 'Value "$%s" is not an email address.');
$this->from = new From($email, $name);
} After digging a bit more, I'm a bit worried because this PR has also breaking changes: That's it for now! |
|
||
$data = range(1, 25); | ||
$groups = new GroupsToDisplay($data); | ||
$groups->addGroupToDisplay(1); |
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.
nit: it's possible the last line is not run (which is where the expected exception should come from) since the exception could be thrown during construction.
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.
This case test addGroupToDisplay()
we add exeactly 25 groups on object construction - ok
than add one more group - got an exception
anything wrong?
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.
If the max allowed was incorrectly defined as 24, then this test would still pass but the last line would not get executed because the constructor would be the one throwing the exception.
build on php 7.4 failed because of Prism server error |
Closes #754
Closes #987
Checklist
Short description of what this PR does:
Assert
class for strict type validation (100% code coverage with tests)