Skip to content

[Validator] pass error code as a string #32244

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
Jun 28, 2019

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Jun 28, 2019

Q A
Branch? 3.4
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

@nicolas-grekas
Copy link
Member

What's the goal of this change?

@@ -528,7 +528,7 @@ public function testAddCustomizedViolation()
$this->assertSame($entity, $violations[0]->getRoot());
$this->assertSame('Invalid value', $violations[0]->getInvalidValue());
$this->assertSame(2, $violations[0]->getPlural());
$this->assertSame(42, $violations[0]->getCode());
$this->assertSame('42', $violations[0]->getCode());
Copy link
Member Author

Choose a reason for hiding this comment

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

The argument is documented as string in ConstraintViolationBuilderInterface::setCode(). When adding type-hints in 5.0, we will need to compare the returned code with the string '42'. Making the change in the test here makes it consistent across all branches.

Copy link
Contributor

Choose a reason for hiding this comment

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

@nicolas-grekas
Copy link
Member

Thank you @xabbuh.

@nicolas-grekas nicolas-grekas merged commit 901fe0d into symfony:3.4 Jun 28, 2019
nicolas-grekas added a commit that referenced this pull request Jun 28, 2019
This PR was merged into the 3.4 branch.

Discussion
----------

[Validator] pass error code as a string

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commits
-------

901fe0d pass error code as a string
@xabbuh xabbuh deleted the validator-string-code branch June 28, 2019 12:50
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.

4 participants