-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[Validator] Optimize serialized metadata and cleanup tests #61448
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
Conversation
ba2aaf8
to
8076f0b
Compare
'constraintsByGroup' => $this->constraintsByGroup, | ||
'traversalStrategy' => $this->traversalStrategy, | ||
'autoMappingStrategy' => $this->autoMappingStrategy, | ||
return array_filter(parent::__serialize() + [ |
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.
use array_filter to remove properties that are still at their default values.
$constraint->addImplicitGroupName($this->getDefaultGroup()); | ||
$member->addConstraint($constraint); |
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.
Instead of accessing constraintsByGroup
directly
@@ -183,10 +183,14 @@ public function addConstraint(Constraint $constraint): static | |||
return $this; | |||
} | |||
|
|||
$this->constraints[] = $constraint; | |||
if (!\in_array($constraint, $this->constraints, true)) { |
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.
enables adding a constraint twice to bind it to new groups
used by ClassMetadata on L377
@@ -310,8 +310,6 @@ public function getTargets(): string|array | |||
|
|||
/** | |||
* Optimizes the serialized value to minimize storage space. | |||
* | |||
* @internal |
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.
Not needed anymore, __serialize
is what the engine provides to hook on serialization, we cannot "privatize" it IMHO
035d763
to
bd5c311
Compare
bd5c311
to
9f9c52a
Compare
Our tests rely on direct access to
@internal
properties that come with notices like:This should also apply to test cases.
Also, now that we use
__serialize
, we can also make these properties private. I'll propose it in a follow up PR.(failures unrelated)