Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Validator] Deprecate validating DateTimeInterface in Date|Time|DateTime constraints #25015

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

Merged
merged 1 commit into from
Sep 8, 2018
Merged

[Validator] Deprecate validating DateTimeInterface in Date|Time|DateTime constraints #25015

merged 1 commit into from
Sep 8, 2018

Conversation

ro0NL
Copy link
Contributor

@ro0NL ro0NL commented Nov 18, 2017

Q A
Branch? 4.1
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? yes
Tests pass? yes
Fixed tickets #11925
License MIT
Doc PR symfony/symfony-docs#7583 (old PR but not really needed now)

Easy version of #21905. I think individual naming has value. Also the goal is to move forward to use Type really, not to bother with constraint renames.

}

if ($value instanceof \DateTimeInterface) {
@trigger_error(sprintf('Validating a \\DateTimeInterface with "%s" is deprecated since version 4.1 and will throw an exception in 5.0. Use "%s" instead.', DateTime::class, Type::class), E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

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

since Symfony 4.1

Copy link
Member

Choose a reason for hiding this comment

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

4.2 now :)

@nicolas-grekas nicolas-grekas modified the milestones: 4.1, next Apr 20, 2018
Copy link
Member

@fabpot fabpot left a comment

Choose a reason for hiding this comment

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

Can you add a note in the CHANGELOG/UPGRADE files?

}

if ($value instanceof \DateTimeInterface) {
@trigger_error(sprintf('Validating a \\DateTimeInterface with "%s" is deprecated since version 4.1 and will throw an exception in 5.0. Use "%s" instead.', DateTime::class, Type::class), E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

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

4.2 now :)

}

if ($value instanceof \DateTimeInterface) {
@trigger_error(sprintf('Validating a \\DateTimeInterface with "%s" is deprecated since version 4.1 and will throw an exception in 5.0. Use "%s" instead.', Date::class, Type::class), E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

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

Same here

}

if ($value instanceof \DateTimeInterface) {
@trigger_error(sprintf('Validating a \\DateTimeInterface with "%s" is deprecated since version 4.1 and will throw an exception in 5.0. Use "%s" instead.', DateTime::class, Type::class), E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

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

The suggested alternative could also be to remove the constraint if you always have a \DateTimeInterface|null in your property, not especially to add a Type constraint, as this constraint is a no-op for DateTimeInterface

@ro0NL
Copy link
Contributor Author

ro0NL commented Sep 8, 2018

Updated.

@fabpot
Copy link
Member

fabpot commented Sep 8, 2018

Thank you @ro0NL.

@fabpot fabpot merged commit 5454e6f into symfony:master Sep 8, 2018
fabpot added a commit that referenced this pull request Sep 8, 2018
…Date|Time|DateTime constraints (ro0NL)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[Validator] Deprecate validating DateTimeInterface in Date|Time|DateTime constraints

| Q             | A
| ------------- | ---
| Branch?       | 4.1
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #11925
| License       | MIT
| Doc PR        | symfony/symfony-docs#7583 (old PR but not really needed now)

Easy version of #21905. I think individual naming has value. Also the goal is to move forward to use `Type` really, not to bother with constraint renames.

Commits
-------

5454e6f [Validator] Deprecate validating DateTimeInterface in Date|Time|DateTime constraints
@ro0NL ro0NL deleted the date-time-validator branch September 8, 2018 07:17
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Oct 8, 2018
…dators (ro0NL)

This PR was squashed before being merged into the master branch (closes #10302).

Discussion
----------

Remove \DateTimeInterface reference from constraint validators

See symfony/symfony#25015

Commits
-------

47b5917 Remove \DateTimeInterface reference from constraint validators
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.2 Nov 1, 2018
This was referenced Nov 3, 2018
nicolas-grekas added a commit that referenced this pull request May 29, 2019
…ors (ro0NL)

This PR was merged into the 5.0-dev branch.

Discussion
----------

[Validator] Remove DateTime support in date/time validators

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

See #25015

Commits
-------

37c1cbb [Validator] Remove DateTime support in date/time validators
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants