-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
DateTime validator support for trailing data #37097
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
DateTime validator support for trailing data #37097
Conversation
stefankleff
commented
Jun 4, 2020
Q | A |
---|---|
Branch? | 3.4 |
Bug fix? | yes |
New feature? | no |
Deprecations? | no |
Tickets | Fix #37094 |
License | MIT |
@@ -68,6 +68,8 @@ public function validate($value, Constraint $constraint) | |||
->setParameter('{{ value }}', $this->formatValue($value)) | |||
->setCode(DateTime::INVALID_TIME_ERROR) | |||
->addViolation(); | |||
} elseif ('Trailing data' === $warning && '+' === substr($constraint->format, -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.
Could there be cases with more than one warning where we don't want to ignore the other ones?
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.
@stefankleff any idea? Could you please have a look?
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.
@stefankleff Have you time to have a look at this?
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.
Sorry, not yet. But I'll try within this week.
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.
friendly ping
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 case is valid, that we have a "+" in the format and we don't want to ignore the other warnings.
I couldn't find a better way than remove the warning from the list of warnings.
I also looked in the underlying c-code and I couldn't find any similar cases to trailing data.
f3b8721
to
27f6e28
Compare
Thank you @stefankleff. |