-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Deprecate ValidatorBuilder::enableAnnotationMapping()
and ValidatorBuilder::disableAnnotationMapping()
#51426
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 clic 8000 king “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
Conversation
…nd `ValidatorBuilder::disableAnnotationMapping()`
dee9977
to
9fa9c32
Compare
UPGRADE-6.4.md
Outdated
@@ -156,4 +156,6 @@ Validator | |||
* Deprecate Doctrine annotations support in favor of native attributes | |||
* Deprecate passing an annotation reader to the constructor signature of `AnnotationLoader` | |||
* Deprecate `ValidatorBuilder::setDoctrineAnnotationReader()` | |||
* Deprecate `ValidatorBuilder::addDefaultDoctrineAnnotationReader()` | |||
* Deprecate `ValidatorBuilder::addDefaultDoctrineAnnotationReader() |
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.
missing backtick
public function testExpectDeprecationWhenDisablingAnnotationMapping() | ||
{ | ||
$this->expectDeprecation('Since symfony/validator 6.4: Method "Symfony\Component\Validator\ValidatorBuilder::disableAnnotationMapping()" is deprecated, use "disableAttributeMapping()" instead.'); | ||
$this->builder->disableAnnotationMapping(); |
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.
we should not loose the assertion about the fluent API that we had before
@@ -81,7 +81,7 @@ public function testAddMethodMappings() | |||
*/ | |||
public function testEnableAnnotationMappingWithDefaultDoctrineAnnotationReader() | |||
{ | |||
$this->assertSame($this->builder, $this->builder->enableAnnotationMapping()); | |||
$this->assertSame($this->builder, $this->builder->enableAttributeMapping()); |
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 test is really about annotation mapping. So I would rather expect both deprecations in it than changing method
@@ -102,7 +102,7 @@ public function testEnableAnnotationMappingWithCustomDoctrineAnnotationReader() | |||
{ | |||
$reader = $this->createMock(Reader::class); | |||
|
|||
$this->assertSame($this->builder, $this->builder->enableAnnotationMapping()); | |||
$this->assertSame($this->builder, $this->builder->enableAttributeMapping()); |
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.
same here
* | ||
* @return $this | ||
*/ | ||
public function enableAttributeMapping(): static | ||
{ | ||
if (null !== $this->metadataFactory) { | ||
throw new ValidatorException('You cannot enable annotation mapping after setting a custom metadata factory. Configure your metadata factory instead.'); |
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 exception message should be updated
@@ -344,7 +369,7 @@ public function getLoaders(): array | |||
$loaders[] = new StaticMethodLoader($methodName); | |||
} | |||
|
|||
if ($this->enableAnnotationMapping) { | |||
if ($this->enableAttributeMapping) { | |||
$loaders[] = new AnnotationLoader($this->annotationReader); |
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 you don't rename the loader class as well, this work is incomplete
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.
We also need to update the FrameworkExtension
.
Alright, I thought it was the way to deal with the CI that misses some not-yet-merged methods. Closing in favor of #51425, I addressed your comments there 🙂 |
Required by #51425